| set hive.mapred.mode=nonstrict; |
| set hive.optimize.skewjoin.compiletime = true; |
| |
| CREATE TABLE T1_n130(key STRING, val STRING) |
| SKEWED BY (key, val) ON ((2, 12), (8, 18)) STORED AS TEXTFILE; |
| |
| LOAD DATA LOCAL INPATH '../../data/files/T1.txt' INTO TABLE T1_n130; |
| |
| CREATE TABLE T2_n77(key STRING, val STRING) |
| SKEWED BY (key, val) ON ((3, 13), (8, 18)) STORED AS TEXTFILE; |
| |
| LOAD DATA LOCAL INPATH '../../data/files/T2.txt' INTO TABLE T2_n77; |
| |
| -- Both the join tables are skewed by 2 keys, and one of the skewed values |
| -- is common to both the tables. The join key is a subset of the skewed key set: |
| -- it only contains the first skewed key for both the tables |
| -- adding a order by at the end to make the results deterministic |
| |
| EXPLAIN |
| SELECT a.*, b.* FROM T1_n130 a JOIN T2_n77 b ON a.key = b.key; |
| |
| SELECT a.*, b.* FROM T1_n130 a JOIN T2_n77 b ON a.key = b.key |
| ORDER BY a.key, b.key, a.val, b.val; |