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