Ver código fonte

bin_partitioned TPC-H

Gopal V 10 anos atrás
pai
commit
5903b3ae95

+ 8 - 0
ddl-tpch/bin_partitioned/analyze.sql

@@ -0,0 +1,8 @@
+analyze table nation compute statistics for columns;
+analyze table region compute statistics for columns;
+analyze table supplier compute statistics for columns;
+analyze table part compute statistics for columns;
+analyze table partsupp compute statistics for columns;
+analyze table customer compute statistics for columns;
+analyze table orders compute statistics for columns;
+analyze table lineitem compute statistics for columns;

+ 12 - 0
ddl-tpch/bin_partitioned/customer.sql

@@ -0,0 +1,12 @@
+create database if not exists ${DB};
+use ${DB};
+
+drop table if exists customer;
+
+create table customer
+stored as ${FILE}
+TBLPROPERTIES('orc.bloom.filter.columns'='*','orc.compress'='ZLIB')
+as select * from ${SOURCE}.customer
+cluster by C_MKTSEGMENT
+;
+

+ 48 - 0
ddl-tpch/bin_partitioned/lineitem.sql

@@ -0,0 +1,48 @@
+create database if not exists ${DB};
+use ${DB};
+
+drop table if exists lineitem;
+
+create table lineitem 
+(L_ORDERKEY BIGINT,
+ L_PARTKEY INT,
+ L_SUPPKEY INT,
+ L_LINENUMBER INT,
+ L_QUANTITY DOUBLE,
+ L_EXTENDEDPRICE DOUBLE,
+ L_DISCOUNT DOUBLE,
+ L_TAX DOUBLE,
+ L_RETURNFLAG STRING,
+ L_LINESTATUS STRING,
+ L_COMMITDATE STRING,
+ L_RECEIPTDATE STRING,
+ L_SHIPINSTRUCT STRING,
+ L_SHIPMODE STRING,
+ L_COMMENT STRING)
+ partitioned by (L_SHIPDATE STRING)
+stored as ${FILE}
+;
+
+ALTER TABLE lineitem SET TBLPROPERTIES('orc.bloom.filter.columns'='*','orc.compress'='ZLIB');
+
+INSERT OVERWRITE TABLE lineitem Partition(L_SHIPDATE)
+select 
+L_ORDERKEY ,
+ L_PARTKEY ,
+ L_SUPPKEY ,
+ L_LINENUMBER ,
+ L_QUANTITY ,
+ L_EXTENDEDPRICE ,
+ L_DISCOUNT ,
+ L_TAX ,
+ L_RETURNFLAG ,
+ L_LINESTATUS ,
+ L_COMMITDATE ,
+ L_RECEIPTDATE ,
+ L_SHIPINSTRUCT ,
+ L_SHIPMODE ,
+ L_COMMENT ,
+ L_SHIPDATE
+ from ${SOURCE}.lineitem
+;
+

+ 9 - 0
ddl-tpch/bin_partitioned/nation.sql

@@ -0,0 +1,9 @@
+create database if not exists ${DB};
+use ${DB};
+
+drop table if exists nation;
+
+create table nation
+stored as ${FILE}
+TBLPROPERTIES('orc.bloom.filter.columns'='*','orc.compress'='ZLIB')
+as select distinct * from ${SOURCE}.nation;

+ 34 - 0
ddl-tpch/bin_partitioned/orders.sql

@@ -0,0 +1,34 @@
+create database if not exists ${DB};
+use ${DB};
+
+drop table if exists orders;
+
+create table orders (O_ORDERKEY INT,
+ O_CUSTKEY BIGINT,
+ O_ORDERSTATUS STRING,
+ O_TOTALPRICE DOUBLE,
+ O_ORDERPRIORITY STRING,
+ O_CLERK STRING,
+ O_SHIPPRIORITY INT,
+ O_COMMENT STRING)
+ partitioned by (O_ORDERDATE STRING)
+stored as ${FILE}
+;
+
+ALTER TABLE orders SET TBLPROPERTIES('orc.bloom.filter.columns'='*','orc.compress'='ZLIB');
+
+INSERT OVERWRITE TABLE orders partition(O_ORDERDATE)
+select 
+O_ORDERKEY ,
+ O_CUSTKEY ,
+ O_ORDERSTATUS ,
+ O_TOTALPRICE ,
+ O_ORDERPRIORITY ,
+ O_CLERK ,
+ O_SHIPPRIORITY ,
+ O_COMMENT,
+ O_ORDERDATE
+  from ${SOURCE}.orders
+;
+
+

+ 11 - 0
ddl-tpch/bin_partitioned/part.sql

@@ -0,0 +1,11 @@
+create database if not exists ${DB};
+use ${DB};
+
+drop table if exists part;
+
+create table part
+stored as ${FILE}
+TBLPROPERTIES('orc.bloom.filter.columns'='*','orc.compress'='ZLIB')
+as select * from ${SOURCE}.part
+cluster by p_brand
+;

+ 12 - 0
ddl-tpch/bin_partitioned/partsupp.sql

@@ -0,0 +1,12 @@
+create database if not exists ${DB};
+use ${DB};
+
+drop table if exists partsupp;
+
+create table partsupp
+stored as ${FILE}
+TBLPROPERTIES('orc.bloom.filter.columns'='*','orc.compress'='ZLIB')
+as select * from ${SOURCE}.partsupp
+cluster by PS_SUPPKEY
+;
+

+ 9 - 0
ddl-tpch/bin_partitioned/region.sql

@@ -0,0 +1,9 @@
+create database if not exists ${DB};
+use ${DB};
+
+drop table if exists region;
+
+create table region
+stored as ${FILE}
+TBLPROPERTIES('orc.bloom.filter.columns'='*','orc.compress'='ZLIB')
+as select distinct * from ${SOURCE}.region;

+ 11 - 0
ddl-tpch/bin_partitioned/supplier.sql

@@ -0,0 +1,11 @@
+create database if not exists ${DB};
+use ${DB};
+
+drop table if exists supplier;
+
+create table supplier
+stored as ${FILE}
+TBLPROPERTIES('orc.bloom.filter.columns'='*','orc.compress'='ZLIB')
+as select * from ${SOURCE}.supplier
+cluster by s_nationkey, s_suppkey
+;