blob: 0e948d63f713d87004743a0a377a90c7cb464482 [file] [log] [blame]
Yingyi Bu391f09e2015-10-29 13:49:39 -07001/*
2 * Licensed to the Apache Software Foundation (ASF) under one
3 * or more contributor license agreements. See the NOTICE file
4 * distributed with this work for additional information
5 * regarding copyright ownership. The ASF licenses this file
6 * to you under the Apache License, Version 2.0 (the
7 * "License"); you may not use this file except in compliance
8 * with the License. You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing,
13 * software distributed under the License is distributed on an
14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 * KIND, either express or implied. See the License for the
16 * specific language governing permissions and limitations
17 * under the License.
18 */
19
20drop database tpch if exists;
21create database tpch;
22
23use tpch;
24
25
26create type tpch.LineItemType as
27 closed {
28 l_orderkey : int32,
29 l_partkey : int32,
30 l_suppkey : int32,
31 l_linenumber : int32,
32 l_quantity : double,
33 l_extendedprice : double,
34 l_discount : double,
35 l_tax : double,
36 l_returnflag : string,
37 l_linestatus : string,
38 l_shipdate : string,
39 l_commitdate : string,
40 l_receiptdate : string,
41 l_shipinstruct : string,
42 l_shipmode : string,
43 l_comment : string
44}
45
46create type tpch.LineIDType as
47 closed {
48 l_orderkey : int32,
49 l_partkey : int32,
50 l_suppkey : int32
51}
52
53create nodegroup group1 if not exists on
Ian Maxonf7b64532015-12-09 17:28:18 -080054 asterix_nc1,
55 asterix_nc2
Yingyi Bu391f09e2015-10-29 13:49:39 -070056;
57create table LineItems_q1(LineItemType) primary key l_orderkey on group1;
58
59create table LineID(LineIDType) primary key l_orderkey on group1;
60
61create index idx_LineID_partkey on LineID (l_partkey) type btree;
62
63create index idx_LineID_suppkey on LineID (l_suppkey) type btree;
64
65insert into LineID
66select element {'l_orderkey':l.l_orderkey,'l_partkey':l.l_partkey,'l_suppkey':l.l_partkey}
67from LineItems_q1 as l
68;