Skip to content

Commit

Permalink
orc flat schemas
Browse files Browse the repository at this point in the history
  • Loading branch information
t3rmin4t0r committed May 3, 2014
1 parent ec46191 commit cb0b5ea
Showing 1 changed file with 97 additions and 0 deletions.
97 changes: 97 additions & 0 deletions ddl/orc.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
set hive.stats.autogather=true;
set hive.stats.dbclass=fs;

create table if not exists lineitem
(L_ORDERKEY INT,
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_SHIPDATE STRING,
L_COMMITDATE STRING,
L_RECEIPTDATE STRING,
L_SHIPINSTRUCT STRING,
L_SHIPMODE STRING,
L_COMMENT STRING)
STORED AS ORC TBLPROPERTIES ("orc.compress"="SNAPPY")
;

create table if not exists part (P_PARTKEY INT,
P_NAME STRING,
P_MFGR STRING,
P_BRAND STRING,
P_TYPE STRING,
P_SIZE INT,
P_CONTAINER STRING,
P_RETAILPRICE DOUBLE,
P_COMMENT STRING)
STORED AS ORC TBLPROPERTIES ("orc.compress"="SNAPPY")
;

create table if not exists supplier (S_SUPPKEY INT,
S_NAME STRING,
S_ADDRESS STRING,
S_NATIONKEY INT,
S_PHONE STRING,
S_ACCTBAL DOUBLE,
S_COMMENT STRING)
STORED AS ORC TBLPROPERTIES ("orc.compress"="SNAPPY")
;

create table if not exists partsupp (PS_PARTKEY INT,
PS_SUPPKEY INT,
PS_AVAILQTY INT,
PS_SUPPLYCOST DOUBLE,
PS_COMMENT STRING)
STORED AS ORC TBLPROPERTIES ("orc.compress"="SNAPPY")
;

create table if not exists nation (N_NATIONKEY INT,
N_NAME STRING,
N_REGIONKEY INT,
N_COMMENT STRING)
STORED AS ORC TBLPROPERTIES ("orc.compress"="SNAPPY")
;

create table if not exists region (R_REGIONKEY INT,
R_NAME STRING,
R_COMMENT STRING)
STORED AS ORC TBLPROPERTIES ("orc.compress"="SNAPPY")
;

create table if not exists customer (C_CUSTKEY INT,
C_NAME STRING,
C_ADDRESS STRING,
C_NATIONKEY INT,
C_PHONE STRING,
C_ACCTBAL DOUBLE,
C_MKTSEGMENT STRING,
C_COMMENT STRING)
STORED AS ORC TBLPROPERTIES ("orc.compress"="SNAPPY")
;

create table if not exists orders (O_ORDERKEY INT,
O_CUSTKEY INT,
O_ORDERSTATUS STRING,
O_TOTALPRICE DOUBLE,
O_ORDERDATE STRING,
O_ORDERPRIORITY STRING,
O_CLERK STRING,
O_SHIPPRIORITY INT,
O_COMMENT STRING)
STORED AS ORC TBLPROPERTIES ("orc.compress"="SNAPPY")
;

insert overwrite table nation select * from ${SOURCE}.nation;
insert overwrite table region select * from ${SOURCE}.region;
insert overwrite table part select * from ${SOURCE}.part;
insert overwrite table supplier select * from ${SOURCE}.supplier;
insert overwrite table partsupp select * from ${SOURCE}.partsupp;
insert overwrite table customer select * from ${SOURCE}.customer;
insert overwrite table lineitem select * from ${SOURCE}.lineitem;
insert overwrite table orders select * from ${SOURCE}.orders;

0 comments on commit cb0b5ea

Please sign in to comment.