buyingyi | cf48fb5 | 2012-11-02 00:31:31 +0000 | [diff] [blame^] | 1 | drop table IF EXISTS lineitem; |
| 2 | |
| 3 | create external table lineitem (L_ORDERKEY INT, L_PARTKEY INT, L_SUPPKEY INT, L_LINENUMBER INT, L_QUANTITY DOUBLE, |
| 4 | L_EXTENDEDPRICE DOUBLE, L_DISCOUNT DOUBLE, L_TAX DOUBLE, L_RETURNFLAG STRING, |
| 5 | L_LINESTATUS STRING, L_SHIPDATE STRING, L_COMMITDATE STRING, L_RECEIPTDATE STRING, |
| 6 | L_SHIPINSTRUCT STRING, L_SHIPMODE STRING, L_COMMENT STRING) ROW FORMAT DELIMITED FIELDS |
| 7 | TERMINATED BY '|' STORED AS TEXTFILE LOCATION '/tpch/lineitem'; |
| 8 | |
| 9 | select * from (select sum(abs(L_QUANTITY)), SUM(L_EXTENDEDPRICE*(1-L_DISCOUNT)*(1+L_TAX)) |
| 10 | FROM lineitem WHERE L_SHIPDATE<='1998-09-02' GROUP BY L_RETURNFLAG) T; |
| 11 | |
| 12 | drop table lineitem; |