buyingyi | c73348c | 2012-11-02 00:31:31 +0000 | [diff] [blame] | 1 | DROP TABLE IF EXISTS orders; |
| 2 | DROP TABLE IF EXISTS customer; |
| 3 | DROP TABLE IF EXISTS u10_join; |
| 4 | |
| 5 | -- create the tables and load the data |
| 6 | create external table 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) ROW FORMAT DELIMITED FIELDS TERMINATED BY '|' STORED AS TEXTFILE LOCATION '/tpch/orders'; |
| 7 | create external table 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) ROW FORMAT DELIMITED FIELDS TERMINATED BY '|' STORED AS TEXTFILE LOCATION '/tpch/customer'; |
| 8 | |
| 9 | create table u10_join(O_ORDERSTATUS STRING); |
| 10 | |
| 11 | insert overwrite table u10_join |
| 12 | select O_TOTALPRICE |
| 13 | from orders join customer |
| 14 | on orders.O_CUSTKEY=customer.C_CUSTKEY |
| 15 | order by O_TOTALPRICE; |