orc.sql 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. set hive.stats.autogather=true;
  2. set hive.stats.dbclass=fs;
  3. create table if not exists lineitem
  4. (L_ORDERKEY BIGINT,
  5. L_PARTKEY BIGINT,
  6. L_SUPPKEY BIGINT,
  7. L_LINENUMBER INT,
  8. L_QUANTITY DOUBLE,
  9. L_EXTENDEDPRICE DOUBLE,
  10. L_DISCOUNT DOUBLE,
  11. L_TAX DOUBLE,
  12. L_RETURNFLAG STRING,
  13. L_LINESTATUS STRING,
  14. L_SHIPDATE STRING,
  15. L_COMMITDATE STRING,
  16. L_RECEIPTDATE STRING,
  17. L_SHIPINSTRUCT STRING,
  18. L_SHIPMODE STRING,
  19. L_COMMENT STRING)
  20. STORED AS ORC TBLPROPERTIES ("orc.compress"="SNAPPY")
  21. ;
  22. create table if not exists part (P_PARTKEY INT,
  23. P_NAME STRING,
  24. P_MFGR STRING,
  25. P_BRAND STRING,
  26. P_TYPE STRING,
  27. P_SIZE INT,
  28. P_CONTAINER STRING,
  29. P_RETAILPRICE DOUBLE,
  30. P_COMMENT STRING)
  31. STORED AS ORC TBLPROPERTIES ("orc.compress"="SNAPPY")
  32. ;
  33. create table if not exists supplier (S_SUPPKEY BIGINT,
  34. S_NAME STRING,
  35. S_ADDRESS STRING,
  36. S_NATIONKEY INT,
  37. S_PHONE STRING,
  38. S_ACCTBAL DOUBLE,
  39. S_COMMENT STRING)
  40. STORED AS ORC TBLPROPERTIES ("orc.compress"="SNAPPY")
  41. ;
  42. create table if not exists partsupp (PS_PARTKEY BIGINT,
  43. PS_SUPPKEY BIGINT,
  44. PS_AVAILQTY INT,
  45. PS_SUPPLYCOST DOUBLE,
  46. PS_COMMENT STRING)
  47. STORED AS ORC TBLPROPERTIES ("orc.compress"="SNAPPY")
  48. ;
  49. create table if not exists nation (N_NATIONKEY INT,
  50. N_NAME STRING,
  51. N_REGIONKEY INT,
  52. N_COMMENT STRING)
  53. STORED AS ORC TBLPROPERTIES ("orc.compress"="SNAPPY")
  54. ;
  55. create table if not exists region (R_REGIONKEY INT,
  56. R_NAME STRING,
  57. R_COMMENT STRING)
  58. STORED AS ORC TBLPROPERTIES ("orc.compress"="SNAPPY")
  59. ;
  60. create table if not exists customer (C_CUSTKEY BIGINT,
  61. C_NAME STRING,
  62. C_ADDRESS STRING,
  63. C_NATIONKEY INT,
  64. C_PHONE STRING,
  65. C_ACCTBAL DOUBLE,
  66. C_MKTSEGMENT STRING,
  67. C_COMMENT STRING)
  68. STORED AS ORC TBLPROPERTIES ("orc.compress"="SNAPPY")
  69. ;
  70. create table if not exists orders (O_ORDERKEY BIGINT,
  71. O_CUSTKEY BIGINT,
  72. O_ORDERSTATUS STRING,
  73. O_TOTALPRICE DOUBLE,
  74. O_ORDERDATE STRING,
  75. O_ORDERPRIORITY STRING,
  76. O_CLERK STRING,
  77. O_SHIPPRIORITY INT,
  78. O_COMMENT STRING)
  79. STORED AS ORC TBLPROPERTIES ("orc.compress"="SNAPPY")
  80. ;
  81. insert overwrite table nation select * from ${SOURCE}.nation;
  82. insert overwrite table region select * from ${SOURCE}.region;
  83. insert overwrite table part select * from ${SOURCE}.part;
  84. insert overwrite table supplier select * from ${SOURCE}.supplier;
  85. insert overwrite table partsupp select * from ${SOURCE}.partsupp;
  86. insert overwrite table customer select * from ${SOURCE}.customer;
  87. insert overwrite table lineitem select * from ${SOURCE}.lineitem;
  88. insert overwrite table orders select * from ${SOURCE}.orders;