-- Licensed to the Apache Software Foundation (ASF) under one
-- or more contributor license agreements.  See the NOTICE file
-- distributed with this work for additional information
-- regarding copyright ownership.  The ASF licenses this file
-- to you under the Apache License, Version 2.0 (the
-- "License"); you may not use this file except in compliance
-- with the License.  You may obtain a copy of the License at
-- 
--   http://www.apache.org/licenses/LICENSE-2.0
-- 
-- Unless required by applicable law or agreed to in writing,
-- software distributed under the License is distributed on an
-- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-- KIND, either express or implied.  See the License for the
-- specific language governing permissions and limitations
-- under the License.

CREATE TABLE `lineorder` (
  `lo_orderkey` bigint(20) NULL COMMENT "",
  `lo_linenumber` bigint(20) NULL COMMENT "",
  `lo_custkey` int(11) NULL COMMENT "",
  `lo_partkey` int(11) NULL COMMENT "",
  `lo_suppkey` int(11) NULL COMMENT "",
  `lo_orderdate` int(11) NULL COMMENT "",
  `lo_orderpriority` varchar(16) NULL COMMENT "",
  `lo_shippriority` int(11) NULL COMMENT "",
  `lo_quantity` bigint(20) NULL COMMENT "",
  `lo_extendedprice` bigint(20) NULL COMMENT "",
  `lo_ordtotalprice` bigint(20) NULL COMMENT "",
  `lo_discount` bigint(20) NULL COMMENT "",
  `lo_revenue` bigint(20) NULL COMMENT "",
  `lo_supplycost` bigint(20) NULL COMMENT "",
  `lo_tax` bigint(20) NULL COMMENT "",
  `lo_commitdate` bigint(20) NULL COMMENT "",
  `lo_shipmode` varchar(11) NULL COMMENT ""
)
PARTITION BY RANGE(`lo_orderdate`)
(PARTITION p1992 VALUES [("-2147483648"), ("19930101")),
PARTITION p1993 VALUES [("19930101"), ("19940101")),
PARTITION p1994 VALUES [("19940101"), ("19950101")),
PARTITION p1995 VALUES [("19950101"), ("19960101")),
PARTITION p1996 VALUES [("19960101"), ("19970101")),
PARTITION p1997 VALUES [("19970101"), ("19980101")),
PARTITION p1998 VALUES [("19980101"), ("19990101")))
DISTRIBUTED BY HASH(`lo_orderkey`) BUCKETS 48
PROPERTIES (
"replication_num" = "1"
);

CREATE TABLE `customer` (
  `c_custkey` int(11) NULL COMMENT "",
  `c_name` varchar(26) NULL COMMENT "",
  `c_address` varchar(41) NULL COMMENT "",
  `c_city` varchar(11) NULL COMMENT "",
  `c_nation` varchar(16) NULL COMMENT "",
  `c_region` varchar(13) NULL COMMENT "",
  `c_phone` varchar(16) NULL COMMENT "",
  `c_mktsegment` varchar(11) NULL COMMENT ""
)
DISTRIBUTED BY HASH(`c_custkey`) BUCKETS 10
PROPERTIES (
"replication_num" = "1"
);

CREATE TABLE `date` (
  `d_datekey` int(11) NULL COMMENT "",
  `d_date` varchar(20) NULL COMMENT "",
  `d_dayofweek` varchar(10) NULL COMMENT "",
  `d_month` varchar(11) NULL COMMENT "",
  `d_year` int(11) NULL COMMENT "",
  `d_yearmonthnum` int(11) NULL COMMENT "",
  `d_yearmonth` varchar(9) NULL COMMENT "",
  `d_daynuminweek` int(11) NULL COMMENT "",
  `d_daynuminmonth` int(11) NULL COMMENT "",
  `d_daynuminyear` int(11) NULL COMMENT "",
  `d_monthnuminyear` int(11) NULL COMMENT "",
  `d_weeknuminyear` int(11) NULL COMMENT "",
  `d_sellingseason` varchar(14) NULL COMMENT "",
  `d_lastdayinweekfl` int(11) NULL COMMENT "",
  `d_lastdayinmonthfl` int(11) NULL COMMENT "",
  `d_holidayfl` int(11) NULL COMMENT "",
  `d_weekdayfl` int(11) NULL COMMENT ""
)
DISTRIBUTED BY HASH(`d_datekey`) BUCKETS 1
PROPERTIES (
"replication_num" = "1"
);

CREATE TABLE `part` (
  `p_partkey` int(11) NULL COMMENT "",
  `p_name` varchar(23) NULL COMMENT "",
  `p_mfgr` varchar(7) NULL COMMENT "",
  `p_category` varchar(8) NULL COMMENT "",
  `p_brand` varchar(10) NULL COMMENT "",
  `p_color` varchar(12) NULL COMMENT "",
  `p_type` varchar(26) NULL COMMENT "",
  `p_size` int(11) NULL COMMENT "",
  `p_container` varchar(11) NULL COMMENT ""
)
DISTRIBUTED BY HASH(`p_partkey`) BUCKETS 10
PROPERTIES (
"replication_num" = "1"
);

CREATE TABLE `supplier` (
  `s_suppkey` int(11) NULL COMMENT "",
  `s_name` varchar(26) NULL COMMENT "",
  `s_address` varchar(26) NULL COMMENT "",
  `s_city` varchar(11) NULL COMMENT "",
  `s_nation` varchar(16) NULL COMMENT "",
  `s_region` varchar(13) NULL COMMENT "",
  `s_phone` varchar(16) NULL COMMENT ""
)
DISTRIBUTED BY HASH(`s_suppkey`) BUCKETS 10
PROPERTIES (
"replication_num" = "1"
);
