alltables.sql 2.4 KB

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