blob: ce94ac6ffbdcae5722a48c201ec25fea98e26425 [file] [log] [blame]
buyingyicf48fb52012-11-02 00:31:31 +00001DROP TABLE IF EXISTS nation;
2DROP TABLE IF EXISTS u10_nestedloop_join;
3
4-- create tables and load data
5create external table nation (N_NATIONKEY INT, N_NAME STRING, N_REGIONKEY INT, N_COMMENT STRING) ROW FORMAT DELIMITED FIELDS TERMINATED BY '|' STORED AS TEXTFILE LOCATION '/tpch/nation';
6
7-- create the target table
8create table u10_nestedloop_join(supp_nation string, cust_nation string, s_nationkey int, c_nationkey int);
9
10-- the query
11insert overwrite table u10_nestedloop_join
12select
13 *
14from
15 (
16 select
17 n1.n_name as supp_nation, n2.n_name as cust_nation, n1.n_nationkey as s_nationkey,
18 n2.n_nationkey as c_nationkey
19from
20 nation n1 join nation n2 where n1.n_nationkey > n2.n_nationkey
21) a;