buyingyi | cf48fb5 | 2012-11-02 00:31:31 +0000 | [diff] [blame] | 1 | drop table IF EXISTS supplier;
|
| 2 | drop table IF EXISTS u3_union;
|
| 3 |
|
| 4 | create external table supplier (S_SUPPKEY INT, S_NAME STRING, S_ADDRESS STRING, S_NATIONKEY INT, S_PHONE STRING, S_ACCTBAL DOUBLE, S_COMMENT STRING) ROW FORMAT DELIMITED FIELDS TERMINATED BY '|' STORED AS TEXTFILE LOCATION '/tpch/supplier';
|
| 5 | create table u3_union (S_SUPPKEY INT, S_ADDRESS STRING, S_NATIONKEY INT, S_NAME STRING);
|
| 6 |
|
| 7 | insert overwrite table u3_union
|
| 8 | select * from (select (2*s_suppkey), s_address, s_nationkey, s_name FROM supplier where S_SUPPKEY*2 < 20
|
| 9 | union all
|
| 10 | select (2*s_suppkey), s_address, s_nationkey, s_name FROM supplier where S_SUPPKEY*2 > 50) t
|
| 11 | order by t.s_address;
|