Saving all output to "!!{outputDirectory}!!/join_nulls.q.raw". Enter "record" with no arguments to stop it. >>> !run !!{qFileDirectory}!!/join_nulls.q >>> CREATE TABLE myinput1(key int, value int); No rows affected >>> LOAD DATA LOCAL INPATH '../data/files/in1.txt' INTO TABLE myinput1; No rows affected >>> >>> SELECT * FROM myinput1 a JOIN myinput1 b ORDER BY a.key ASC, a.value ASC, b.key ASC, b.value ASC; 'key','value','key','value' '','35','','35' '','35','48','' '','35','100','100' '48','','','35' '48','','48','' '48','','100','100' '100','100','','35' '100','100','48','' '100','100','100','100' 9 rows selected >>> SELECT * FROM myinput1 a LEFT OUTER JOIN myinput1 b ORDER BY a.key ASC, a.value ASC, b.key ASC, b.value ASC; 'key','value','key','value' '','35','','35' '','35','48','' '','35','100','100' '48','','','35' '48','','48','' '48','','100','100' '100','100','','35' '100','100','48','' '100','100','100','100' 9 rows selected >>> SELECT * FROM myinput1 a RIGHT OUTER JOIN myinput1 b ORDER BY a.key ASC, a.value ASC, b.key ASC, b.value ASC; 'key','value','key','value' '','35','','35' '','35','48','' '','35','100','100' '48','','','35' '48','','48','' '48','','100','100' '100','100','','35' '100','100','48','' '100','100','100','100' 9 rows selected >>> SELECT * FROM myinput1 a JOIN myinput1 b ON a.key = b.value ORDER BY a.key ASC, a.value ASC, b.key ASC, b.value ASC; 'key','value','key','value' '100','100','100','100' 1 row selected >>> SELECT * FROM myinput1 a JOIN myinput1 b ON a.key = b.key ORDER BY a.key ASC, a.value ASC, b.key ASC, b.value ASC; 'key','value','key','value' '48','','48','' '100','100','100','100' 2 rows selected >>> SELECT * FROM myinput1 a JOIN myinput1 b ON a.value = b.value ORDER BY a.key ASC, a.value ASC, b.key ASC, b.value ASC; 'key','value','key','value' '','35','','35' '100','100','100','100' 2 rows selected >>> SELECT * FROM myinput1 a JOIN myinput1 b ON a.value = b.value and a.key=b.key ORDER BY a.key ASC, a.value ASC, b.key ASC, b.value ASC; 'key','value','key','value' '100','100','100','100' 1 row selected >>> SELECT * FROM myinput1 a LEFT OUTER JOIN myinput1 b ON a.key = b.value ORDER BY a.key ASC, a.value ASC, b.key ASC, b.value ASC; 'key','value','key','value' '','35','','' '48','','','' '100','100','100','100' 3 rows selected >>> SELECT * FROM myinput1 a LEFT OUTER JOIN myinput1 b ON a.value = b.value ORDER BY a.key ASC, a.value ASC, b.key ASC, b.value ASC; 'key','value','key','value' '','35','','35' '48','','','' '100','100','100','100' 3 rows selected >>> SELECT * FROM myinput1 a LEFT OUTER JOIN myinput1 b ON a.key = b.key ORDER BY a.key ASC, a.value ASC, b.key ASC, b.value ASC; 'key','value','key','value' '','35','','' '48','','48','' '100','100','100','100' 3 rows selected >>> SELECT * FROM myinput1 a LEFT OUTER JOIN myinput1 b ON a.key = b.key and a.value=b.value ORDER BY a.key ASC, a.value ASC, b.key ASC, b.value ASC; 'key','value','key','value' '','35','','' '48','','','' '100','100','100','100' 3 rows selected >>> SELECT * FROM myinput1 a RIGHT OUTER JOIN myinput1 b ON a.key = b.value ORDER BY a.key ASC, a.value ASC, b.key ASC, b.value ASC; 'key','value','key','value' '','','','35' '','','48','' '100','100','100','100' 3 rows selected >>> SELECT * FROM myinput1 a RIGHT OUTER JOIN myinput1 b ON a.key = b.key ORDER BY a.key ASC, a.value ASC, b.key ASC, b.value ASC; 'key','value','key','value' '','','','35' '48','','48','' '100','100','100','100' 3 rows selected >>> SELECT * FROM myinput1 a RIGHT OUTER JOIN myinput1 b ON a.value = b.value ORDER BY a.key ASC, a.value ASC, b.key ASC, b.value ASC; 'key','value','key','value' '','','48','' '','35','','35' '100','100','100','100' 3 rows selected >>> SELECT * FROM myinput1 a RIGHT OUTER JOIN myinput1 b ON a.key=b.key and a.value = b.value ORDER BY a.key ASC, a.value ASC, b.key ASC, b.value ASC; 'key','value','key','value' '','','','35' '','','48','' '100','100','100','100' 3 rows selected >>> SELECT * FROM myinput1 a FULL OUTER JOIN myinput1 b ON a.key = b.value ORDER BY a.key ASC, a.value ASC, b.key ASC, b.value ASC; 'key','value','key','value' '','','','35' '','','48','' '','35','','' '48','','','' '100','100','100','100' 5 rows selected >>> SELECT * FROM myinput1 a FULL OUTER JOIN myinput1 b ON a.key = b.key ORDER BY a.key ASC, a.value ASC, b.key ASC, b.value ASC; 'key','value','key','value' '','','','35' '','35','','' '48','','48','' '100','100','100','100' 4 rows selected >>> SELECT * FROM myinput1 a FULL OUTER JOIN myinput1 b ON a.value = b.value ORDER BY a.key ASC, a.value ASC, b.key ASC, b.value ASC; 'key','value','key','value' '','','48','' '','35','','35' '48','','','' '100','100','100','100' 4 rows selected >>> SELECT * FROM myinput1 a FULL OUTER JOIN myinput1 b ON a.value = b.value and a.key=b.key ORDER BY a.key ASC, a.value ASC, b.key ASC, b.value ASC; 'key','value','key','value' '','','','35' '','','48','' '','35','','' '48','','','' '100','100','100','100' 5 rows selected >>> >>> SELECT * from myinput1 a LEFT OUTER JOIN myinput1 b ON (a.value=b.value) RIGHT OUTER JOIN myinput1 c ON (b.value=c.value) ORDER BY a.key ASC, a.value ASC, b.key ASC, b.value ASC; 'key','value','key','value','key','value' '','','','','48','' '','35','','35','','35' '100','100','100','100','100','100' 3 rows selected >>> SELECT * from myinput1 a RIGHT OUTER JOIN myinput1 b ON (a.value=b.value) LEFT OUTER JOIN myinput1 c ON (b.value=c.value) ORDER BY a.key ASC, a.value ASC, b.key ASC, b.value ASC; 'key','value','key','value','key','value' '','','48','','','' '','35','','35','','35' '100','100','100','100','100','100' 3 rows selected >>> SELECT * FROM myinput1 a LEFT OUTER JOIN myinput1 b RIGHT OUTER JOIN myinput1 c ON a.value = b.value and b.value = c.value ORDER BY a.key ASC, a.value ASC, b.key ASC, b.value ASC; 'key','value','key','value','key','value' '','','','','48','' '','35','','35','','35' '100','100','100','100','100','100' 3 rows selected >>> >>> SELECT /*+ MAPJOIN(a) */ * FROM myinput1 a JOIN myinput1 b ORDER BY a.key ASC, a.value ASC, b.key ASC, b.value ASC; 'key','value','key','value' '','35','','35' '','35','48','' '','35','100','100' '48','','','35' '48','','48','' '48','','100','100' '100','100','','35' '100','100','48','' '100','100','100','100' 9 rows selected >>> SELECT /*+ MAPJOIN(a) */ * FROM myinput1 a JOIN myinput1 b ON a.key = b.value ORDER BY a.key ASC, a.value ASC, b.key ASC, b.value ASC; 'key','value','key','value' '100','100','100','100' 1 row selected >>> SELECT /*+ MAPJOIN(a) */ * FROM myinput1 a JOIN myinput1 b ON a.key = b.key ORDER BY a.key ASC, a.value ASC, b.key ASC, b.value ASC; 'key','value','key','value' '48','','48','' '100','100','100','100' 2 rows selected >>> SELECT /*+ MAPJOIN(a) */ * FROM myinput1 a JOIN myinput1 b ON a.value = b.value ORDER BY a.key ASC, a.value ASC, b.key ASC, b.value ASC; 'key','value','key','value' '','35','','35' '100','100','100','100' 2 rows selected >>> SELECT /*+ MAPJOIN(b) */ * FROM myinput1 a JOIN myinput1 b ON a.key = b.value ORDER BY a.key ASC, a.value ASC, b.key ASC, b.value ASC; 'key','value','key','value' '100','100','100','100' 1 row selected >>> SELECT /*+ MAPJOIN(b) */ * FROM myinput1 a JOIN myinput1 b ON a.key = b.key ORDER BY a.key ASC, a.value ASC, b.key ASC, b.value ASC; 'key','value','key','value' '48','','48','' '100','100','100','100' 2 rows selected >>> SELECT /*+ MAPJOIN(b) */ * FROM myinput1 a JOIN myinput1 b ON a.value = b.value ORDER BY a.key ASC, a.value ASC, b.key ASC, b.value ASC; 'key','value','key','value' '','35','','35' '100','100','100','100' 2 rows selected >>> SELECT /*+ MAPJOIN(b) */ * FROM myinput1 a JOIN myinput1 b ON a.value = b.value and a.key = b.key ORDER BY a.key ASC, a.value ASC, b.key ASC, b.value ASC; 'key','value','key','value' '100','100','100','100' 1 row selected >>> SELECT /*+ MAPJOIN(b) */ * FROM myinput1 a LEFT OUTER JOIN myinput1 b ON a.key = b.value ORDER BY a.key ASC, a.value ASC, b.key ASC, b.value ASC; 'key','value','key','value' '','35','','' '48','','','' '100','100','100','100' 3 rows selected >>> SELECT /*+ MAPJOIN(b) */ * FROM myinput1 a LEFT OUTER JOIN myinput1 b ON a.key = b.key ORDER BY a.key ASC, a.value ASC, b.key ASC, b.value ASC; 'key','value','key','value' '','35','','' '48','','48','' '100','100','100','100' 3 rows selected >>> SELECT /*+ MAPJOIN(b) */ * FROM myinput1 a LEFT OUTER JOIN myinput1 b ON a.value = b.value ORDER BY a.key ASC, a.value ASC, b.key ASC, b.value ASC; 'key','value','key','value' '','35','','35' '48','','','' '100','100','100','100' 3 rows selected >>> SELECT /*+ MAPJOIN(a) */ * FROM myinput1 a RIGHT OUTER JOIN myinput1 b ON a.key = b.value ORDER BY a.key ASC, a.value ASC, b.key ASC, b.value ASC; 'key','value','key','value' '','','','35' '','','48','' '100','100','100','100' 3 rows selected >>> SELECT /*+ MAPJOIN(a) */ * FROM myinput1 a RIGHT OUTER JOIN myinput1 b ON a.key = b.key ORDER BY a.key ASC, a.value ASC, b.key ASC, b.value ASC; 'key','value','key','value' '','','','35' '48','','48','' '100','100','100','100' 3 rows selected >>> SELECT /*+ MAPJOIN(a) */ * FROM myinput1 a RIGHT OUTER JOIN myinput1 b ON a.value = b.value ORDER BY a.key ASC, a.value ASC, b.key ASC, b.value ASC; 'key','value','key','value' '','','48','' '','35','','35' '100','100','100','100' 3 rows selected >>> >>> CREATE TABLE smb_input1(key int, value int) CLUSTERED BY (key) SORTED BY (key) INTO 2 BUCKETS; No rows affected >>> CREATE TABLE smb_input2(key int, value int) CLUSTERED BY (value) SORTED BY (value) INTO 2 BUCKETS; No rows affected >>> LOAD DATA LOCAL INPATH '../data/files/in1.txt' into table smb_input1; No rows affected >>> LOAD DATA LOCAL INPATH '../data/files/in2.txt' into table smb_input1; No rows affected >>> LOAD DATA LOCAL INPATH '../data/files/in1.txt' into table smb_input2; No rows affected >>> LOAD DATA LOCAL INPATH '../data/files/in2.txt' into table smb_input2; No rows affected >>> >>> SET hive.optimize.bucketmapJOIN = true; No rows affected >>> SET hive.optimize.bucketmapJOIN.sortedmerge = true; No rows affected >>> SET hive.input.format = org.apache.hadoop.hive.ql.io.BucketizedHiveInputFormat; No rows affected >>> >>> SELECT /*+ MAPJOIN(a) */ * FROM smb_input1 a JOIN smb_input1 b ON a.key = b.key ORDER BY a.key ASC, a.value ASC, b.key ASC, b.value ASC; 'key','value','key','value' '48','','48','' '100','100','100','100' '148','','148','' '200','200','200','200' 4 rows selected >>> SELECT /*+ MAPJOIN(a) */ * FROM smb_input1 a JOIN smb_input1 b ON a.key = b.key AND a.value = b.value ORDER BY a.key ASC, a.value ASC, b.key ASC, b.value ASC; 'key','value','key','value' '100','100','100','100' '200','200','200','200' 2 rows selected >>> SELECT /*+ MAPJOIN(a) */ * FROM smb_input1 a RIGHT OUTER JOIN smb_input1 b ON a.key = b.key ORDER BY a.key ASC, a.value ASC, b.key ASC, b.value ASC; 'key','value','key','value' '','','','35' '','','','135' '48','','48','' '100','100','100','100' '148','','148','' '200','200','200','200' 6 rows selected >>> SELECT /*+ MAPJOIN(b) */ * FROM smb_input1 a JOIN smb_input1 b ON a.key = b.key ORDER BY a.key ASC, a.value ASC, b.key ASC, b.value ASC; 'key','value','key','value' '48','','48','' '100','100','100','100' '148','','148','' '200','200','200','200' 4 rows selected >>> SELECT /*+ MAPJOIN(b) */ * FROM smb_input1 a LEFT OUTER JOIN smb_input1 b ON a.key = b.key ORDER BY a.key ASC, a.value ASC, b.key ASC, b.value ASC; 'key','value','key','value' '','35','','' '','135','','' '48','','48','' '100','100','100','100' '148','','148','' '200','200','200','200' 6 rows selected >>> >>> SELECT /*+ MAPJOIN(a) */ * FROM smb_input1 a JOIN smb_input2 b ON a.key = b.value ORDER BY a.key ASC, a.value ASC, b.key ASC, b.value ASC; 'key','value','key','value' '100','100','100','100' '200','200','200','200' 2 rows selected >>> SELECT /*+ MAPJOIN(b) */ * FROM smb_input1 a JOIN smb_input2 b ON a.key = b.value ORDER BY a.key ASC, a.value ASC, b.key ASC, b.value ASC; 'key','value','key','value' '100','100','100','100' '200','200','200','200' 2 rows selected >>> SELECT /*+ MAPJOIN(b) */ * FROM smb_input1 a LEFT OUTER JOIN smb_input2 b ON a.key = b.value ORDER BY a.key ASC, a.value ASC, b.key ASC, b.value ASC; 'key','value','key','value' '','35','','' '','135','','' '48','','','' '100','100','100','100' '148','','','' '200','200','200','200' 6 rows selected >>> SELECT /*+ MAPJOIN(a) */ * FROM smb_input1 a RIGHT OUTER JOIN smb_input2 b ON a.key = b.value ORDER BY a.key ASC, a.value ASC, b.key ASC, b.value ASC; 'key','value','key','value' '','','','35' '','','','135' '','','48','' '','','148','' '100','100','100','100' '200','200','200','200' 6 rows selected >>> >>> SELECT /*+ MAPJOIN(a) */ * FROM smb_input2 a JOIN smb_input2 b ON a.value = b.value ORDER BY a.key ASC, a.value ASC, b.key ASC, b.value ASC; 'key','value','key','value' '','35','','35' '','135','','135' '100','100','100','100' '200','200','200','200' 4 rows selected >>> SELECT /*+ MAPJOIN(a) */ * FROM smb_input2 a RIGHT OUTER JOIN smb_input2 b ON a.value = b.value ORDER BY a.key ASC, a.value ASC, b.key ASC, b.value ASC; 'key','value','key','value' '','','48','' '','','148','' '','35','','35' '','135','','135' '100','100','100','100' '200','200','200','200' 6 rows selected >>> SELECT /*+ MAPJOIN(b) */ * FROM smb_input2 a JOIN smb_input2 b ON a.value = b.value ORDER BY a.key ASC, a.value ASC, b.key ASC, b.value ASC; 'key','value','key','value' '','35','','35' '','135','','135' '100','100','100','100' '200','200','200','200' 4 rows selected >>> SELECT /*+ MAPJOIN(b) */ * FROM smb_input2 a LEFT OUTER JOIN smb_input2 b ON a.value = b.value ORDER BY a.key ASC, a.value ASC, b.key ASC, b.value ASC; 'key','value','key','value' '','35','','35' '','135','','135' '48','','','' '100','100','100','100' '148','','','' '200','200','200','200' 6 rows selected >>> !record