Files
impala/testdata/workloads/functional-query/queries/QueryTest/outer-joins.test
Dimitris Tsirogiannis 5a6f53db16 Add partition pruning tests
The following changes are included in this commit:
1. Modified the alltypesagg table to include an additional partition key
that has nulls.
2. Added a number of tests in hdfs.test that exercise the partition
pruning logic (see IMPALA-887).
3. Modified all the tests that are affected by the change in alltypesagg.

Change-Id: I1a769375aaa71273341522eb94490ba5e4c6f00d
Reviewed-on: http://gerrit.ent.cloudera.com:8080/2874
Reviewed-by: Dimitris Tsirogiannis <dtsirogiannis@cloudera.com>
Tested-by: jenkins
Reviewed-on: http://gerrit.ent.cloudera.com:8080/3236
2014-06-24 02:14:27 -07:00

630 lines
20 KiB
Plaintext

====
---- QUERY
# join cols aren't part of select list (and still get materialized)
select j.test_name, d.name
from JoinTbl j inner join DimTbl d on (j.test_id = d.id)
---- RESULTS
'Name1','Name1'
'Name16','Name6'
'Name16','Name6'
'Name16','Name6'
'Name16','Name6'
'Name2','Name2'
'Name3','Name3'
'Name4','Name4'
'Name5','Name5'
'Name6','Name6'
'Name6','Name6'
---- TYPES
string, string
====
---- QUERY
# join on bigint
select j.*, d.*
from JoinTbl j inner join DimTbl d on (j.test_id = d.id)
---- RESULTS
1001,'Name1',94611,5000,1001,'Name1',94611
1002,'Name2',94611,5000,1002,'Name2',94611
1003,'Name3',94611,5000,1003,'Name3',94612
1004,'Name4',94611,5000,1004,'Name4',94612
1005,'Name5',94611,5000,1005,'Name5',94613
1006,'Name16',94612,15000,1006,'Name6',94613
1006,'Name16',94612,5000,1006,'Name6',94613
1006,'Name16',94616,15000,1006,'Name6',94613
1006,'Name16',94616,5000,1006,'Name6',94613
1006,'Name6',94616,15000,1006,'Name6',94613
1006,'Name6',94616,5000,1006,'Name6',94613
---- TYPES
bigint, string, int, int, bigint, string, int
====
---- QUERY
select j.*, d.*
from JoinTbl j left outer join DimTbl d on (j.test_id = d.id)
---- RESULTS
1001,'Name1',94611,5000,1001,'Name1',94611
1002,'Name2',94611,5000,1002,'Name2',94611
1003,'Name3',94611,5000,1003,'Name3',94612
1004,'Name4',94611,5000,1004,'Name4',94612
1005,'Name5',94611,5000,1005,'Name5',94613
1006,'Name16',94612,15000,1006,'Name6',94613
1006,'Name16',94612,5000,1006,'Name6',94613
1006,'Name16',94616,15000,1006,'Name6',94613
1006,'Name16',94616,5000,1006,'Name6',94613
1006,'Name6',94616,15000,1006,'Name6',94613
1006,'Name6',94616,5000,1006,'Name6',94613
1106,'Name16',94612,15000,NULL,'NULL',NULL
1106,'Name16',94612,5000,NULL,'NULL',NULL
1106,'Name16',94616,15000,NULL,'NULL',NULL
1106,'Name16',94616,5000,NULL,'NULL',NULL
1106,'Name6',94612,15000,NULL,'NULL',NULL
1106,'Name6',94612,5000,NULL,'NULL',NULL
1106,'Name6',94616,15000,NULL,'NULL',NULL
1106,'Name6',94616,5000,NULL,'NULL',NULL
---- TYPES
bigint, string, int, int, bigint, string, int
====
---- QUERY
select j.*, d.*
from JoinTbl j right outer join DimTbl d on (j.test_id = d.id)
---- RESULTS
1001,'Name1',94611,5000,1001,'Name1',94611
1002,'Name2',94611,5000,1002,'Name2',94611
1003,'Name3',94611,5000,1003,'Name3',94612
1004,'Name4',94611,5000,1004,'Name4',94612
1005,'Name5',94611,5000,1005,'Name5',94613
1006,'Name16',94612,15000,1006,'Name6',94613
1006,'Name16',94612,5000,1006,'Name6',94613
1006,'Name16',94616,15000,1006,'Name6',94613
1006,'Name16',94616,5000,1006,'Name6',94613
1006,'Name6',94616,15000,1006,'Name6',94613
1006,'Name6',94616,5000,1006,'Name6',94613
NULL,'NULL',NULL,NULL,1007,'Name7',94614
NULL,'NULL',NULL,NULL,1008,'Name8',94614
NULL,'NULL',NULL,NULL,1009,'Name9',94615
NULL,'NULL',NULL,NULL,1010,'Name10',94615
---- TYPES
bigint, string, int, int, bigint, string, int
====
---- QUERY
select j.*, d.*
from JoinTbl j full outer join DimTbl d on (j.test_id = d.id)
---- RESULTS
1001,'Name1',94611,5000,1001,'Name1',94611
1002,'Name2',94611,5000,1002,'Name2',94611
1003,'Name3',94611,5000,1003,'Name3',94612
1004,'Name4',94611,5000,1004,'Name4',94612
1005,'Name5',94611,5000,1005,'Name5',94613
1006,'Name16',94612,15000,1006,'Name6',94613
1006,'Name16',94612,5000,1006,'Name6',94613
1006,'Name16',94616,15000,1006,'Name6',94613
1006,'Name16',94616,5000,1006,'Name6',94613
1006,'Name6',94616,15000,1006,'Name6',94613
1006,'Name6',94616,5000,1006,'Name6',94613
1106,'Name16',94612,15000,NULL,'NULL',NULL
1106,'Name16',94612,5000,NULL,'NULL',NULL
1106,'Name16',94616,15000,NULL,'NULL',NULL
1106,'Name16',94616,5000,NULL,'NULL',NULL
1106,'Name6',94612,15000,NULL,'NULL',NULL
1106,'Name6',94612,5000,NULL,'NULL',NULL
1106,'Name6',94616,15000,NULL,'NULL',NULL
1106,'Name6',94616,5000,NULL,'NULL',NULL
NULL,'NULL',NULL,NULL,1007,'Name7',94614
NULL,'NULL',NULL,NULL,1008,'Name8',94614
NULL,'NULL',NULL,NULL,1009,'Name9',94615
NULL,'NULL',NULL,NULL,1010,'Name10',94615
---- TYPES
bigint, string, int, int, bigint, string, int
====
---- QUERY
# join on string
select j.*, d.*
from JoinTbl j inner join DimTbl d on (j.test_name = d.name)
---- RESULTS
1001,'Name1',94611,5000,1001,'Name1',94611
1002,'Name2',94611,5000,1002,'Name2',94611
1003,'Name3',94611,5000,1003,'Name3',94612
1004,'Name4',94611,5000,1004,'Name4',94612
1005,'Name5',94611,5000,1005,'Name5',94613
1006,'Name6',94616,15000,1006,'Name6',94613
1006,'Name6',94616,5000,1006,'Name6',94613
1106,'Name6',94612,15000,1006,'Name6',94613
1106,'Name6',94612,5000,1006,'Name6',94613
1106,'Name6',94616,15000,1006,'Name6',94613
1106,'Name6',94616,5000,1006,'Name6',94613
---- TYPES
bigint, string, int, int, bigint, string, int
====
---- QUERY
select j.*, d.*
from JoinTbl j left outer join DimTbl d on (j.test_name = d.name)
---- RESULTS
1001,'Name1',94611,5000,1001,'Name1',94611
1002,'Name2',94611,5000,1002,'Name2',94611
1003,'Name3',94611,5000,1003,'Name3',94612
1004,'Name4',94611,5000,1004,'Name4',94612
1005,'Name5',94611,5000,1005,'Name5',94613
1006,'Name16',94612,15000,NULL,'NULL',NULL
1006,'Name16',94612,5000,NULL,'NULL',NULL
1006,'Name16',94616,15000,NULL,'NULL',NULL
1006,'Name16',94616,5000,NULL,'NULL',NULL
1006,'Name6',94616,15000,1006,'Name6',94613
1006,'Name6',94616,5000,1006,'Name6',94613
1106,'Name16',94612,15000,NULL,'NULL',NULL
1106,'Name16',94612,5000,NULL,'NULL',NULL
1106,'Name16',94616,15000,NULL,'NULL',NULL
1106,'Name16',94616,5000,NULL,'NULL',NULL
1106,'Name6',94612,15000,1006,'Name6',94613
1106,'Name6',94612,5000,1006,'Name6',94613
1106,'Name6',94616,15000,1006,'Name6',94613
1106,'Name6',94616,5000,1006,'Name6',94613
---- TYPES
bigint, string, int, int, bigint, string, int
====
---- QUERY
select j.*, d.*
from JoinTbl j right outer join DimTbl d on (j.test_name = d.name)
---- RESULTS
1001,'Name1',94611,5000,1001,'Name1',94611
1002,'Name2',94611,5000,1002,'Name2',94611
1003,'Name3',94611,5000,1003,'Name3',94612
1004,'Name4',94611,5000,1004,'Name4',94612
1005,'Name5',94611,5000,1005,'Name5',94613
1006,'Name6',94616,15000,1006,'Name6',94613
1006,'Name6',94616,5000,1006,'Name6',94613
1106,'Name6',94612,15000,1006,'Name6',94613
1106,'Name6',94612,5000,1006,'Name6',94613
1106,'Name6',94616,15000,1006,'Name6',94613
1106,'Name6',94616,5000,1006,'Name6',94613
NULL,'NULL',NULL,NULL,1007,'Name7',94614
NULL,'NULL',NULL,NULL,1008,'Name8',94614
NULL,'NULL',NULL,NULL,1009,'Name9',94615
NULL,'NULL',NULL,NULL,1010,'Name10',94615
---- TYPES
bigint, string, int, int, bigint, string, int
====
---- QUERY
select j.*, d.*
from JoinTbl j full outer join DimTbl d on (j.test_name = d.name)
---- RESULTS
1001,'Name1',94611,5000,1001,'Name1',94611
1002,'Name2',94611,5000,1002,'Name2',94611
1003,'Name3',94611,5000,1003,'Name3',94612
1004,'Name4',94611,5000,1004,'Name4',94612
1005,'Name5',94611,5000,1005,'Name5',94613
1006,'Name16',94612,15000,NULL,'NULL',NULL
1006,'Name16',94612,5000,NULL,'NULL',NULL
1006,'Name16',94616,15000,NULL,'NULL',NULL
1006,'Name16',94616,5000,NULL,'NULL',NULL
1006,'Name6',94616,15000,1006,'Name6',94613
1006,'Name6',94616,5000,1006,'Name6',94613
1106,'Name16',94612,15000,NULL,'NULL',NULL
1106,'Name16',94612,5000,NULL,'NULL',NULL
1106,'Name16',94616,15000,NULL,'NULL',NULL
1106,'Name16',94616,5000,NULL,'NULL',NULL
1106,'Name6',94612,15000,1006,'Name6',94613
1106,'Name6',94612,5000,1006,'Name6',94613
1106,'Name6',94616,15000,1006,'Name6',94613
1106,'Name6',94616,5000,1006,'Name6',94613
NULL,'NULL',NULL,NULL,1007,'Name7',94614
NULL,'NULL',NULL,NULL,1008,'Name8',94614
NULL,'NULL',NULL,NULL,1009,'Name9',94615
NULL,'NULL',NULL,NULL,1010,'Name10',94615
---- TYPES
bigint, string, int, int, bigint, string, int
====
---- QUERY
# join on int
select j.*, d.*
from JoinTbl j inner join DimTbl d on (j.test_zip = d.zip)
---- RESULTS
1001,'Name1',94611,5000,1001,'Name1',94611
1001,'Name1',94611,5000,1002,'Name2',94611
1002,'Name2',94611,5000,1001,'Name1',94611
1002,'Name2',94611,5000,1002,'Name2',94611
1003,'Name3',94611,5000,1001,'Name1',94611
1003,'Name3',94611,5000,1002,'Name2',94611
1004,'Name4',94611,5000,1001,'Name1',94611
1004,'Name4',94611,5000,1002,'Name2',94611
1005,'Name5',94611,5000,1001,'Name1',94611
1005,'Name5',94611,5000,1002,'Name2',94611
1006,'Name16',94612,15000,1003,'Name3',94612
1006,'Name16',94612,15000,1004,'Name4',94612
1006,'Name16',94612,5000,1003,'Name3',94612
1006,'Name16',94612,5000,1004,'Name4',94612
1106,'Name16',94612,15000,1003,'Name3',94612
1106,'Name16',94612,15000,1004,'Name4',94612
1106,'Name16',94612,5000,1003,'Name3',94612
1106,'Name16',94612,5000,1004,'Name4',94612
1106,'Name6',94612,15000,1003,'Name3',94612
1106,'Name6',94612,15000,1004,'Name4',94612
1106,'Name6',94612,5000,1003,'Name3',94612
1106,'Name6',94612,5000,1004,'Name4',94612
---- TYPES
bigint, string, int, int, bigint, string, int
====
---- QUERY
select j.*, d.*
from JoinTbl j left outer join DimTbl d on (j.test_zip = d.zip)
---- RESULTS
1001,'Name1',94611,5000,1001,'Name1',94611
1001,'Name1',94611,5000,1002,'Name2',94611
1002,'Name2',94611,5000,1001,'Name1',94611
1002,'Name2',94611,5000,1002,'Name2',94611
1003,'Name3',94611,5000,1001,'Name1',94611
1003,'Name3',94611,5000,1002,'Name2',94611
1004,'Name4',94611,5000,1001,'Name1',94611
1004,'Name4',94611,5000,1002,'Name2',94611
1005,'Name5',94611,5000,1001,'Name1',94611
1005,'Name5',94611,5000,1002,'Name2',94611
1006,'Name16',94612,15000,1003,'Name3',94612
1006,'Name16',94612,15000,1004,'Name4',94612
1006,'Name16',94612,5000,1003,'Name3',94612
1006,'Name16',94612,5000,1004,'Name4',94612
1006,'Name16',94616,15000,NULL,'NULL',NULL
1006,'Name16',94616,5000,NULL,'NULL',NULL
1006,'Name6',94616,15000,NULL,'NULL',NULL
1006,'Name6',94616,5000,NULL,'NULL',NULL
1106,'Name16',94612,15000,1003,'Name3',94612
1106,'Name16',94612,15000,1004,'Name4',94612
1106,'Name16',94612,5000,1003,'Name3',94612
1106,'Name16',94612,5000,1004,'Name4',94612
1106,'Name16',94616,15000,NULL,'NULL',NULL
1106,'Name16',94616,5000,NULL,'NULL',NULL
1106,'Name6',94612,15000,1003,'Name3',94612
1106,'Name6',94612,15000,1004,'Name4',94612
1106,'Name6',94612,5000,1003,'Name3',94612
1106,'Name6',94612,5000,1004,'Name4',94612
1106,'Name6',94616,15000,NULL,'NULL',NULL
1106,'Name6',94616,5000,NULL,'NULL',NULL
---- TYPES
bigint, string, int, int, bigint, string, int
====
---- QUERY
select j.*, d.*
from JoinTbl j right outer join DimTbl d on (j.test_zip = d.zip)
---- RESULTS
1001,'Name1',94611,5000,1001,'Name1',94611
1001,'Name1',94611,5000,1002,'Name2',94611
1002,'Name2',94611,5000,1001,'Name1',94611
1002,'Name2',94611,5000,1002,'Name2',94611
1003,'Name3',94611,5000,1001,'Name1',94611
1003,'Name3',94611,5000,1002,'Name2',94611
1004,'Name4',94611,5000,1001,'Name1',94611
1004,'Name4',94611,5000,1002,'Name2',94611
1005,'Name5',94611,5000,1001,'Name1',94611
1005,'Name5',94611,5000,1002,'Name2',94611
1006,'Name16',94612,15000,1003,'Name3',94612
1006,'Name16',94612,15000,1004,'Name4',94612
1006,'Name16',94612,5000,1003,'Name3',94612
1006,'Name16',94612,5000,1004,'Name4',94612
1106,'Name16',94612,15000,1003,'Name3',94612
1106,'Name16',94612,15000,1004,'Name4',94612
1106,'Name16',94612,5000,1003,'Name3',94612
1106,'Name16',94612,5000,1004,'Name4',94612
1106,'Name6',94612,15000,1003,'Name3',94612
1106,'Name6',94612,15000,1004,'Name4',94612
1106,'Name6',94612,5000,1003,'Name3',94612
1106,'Name6',94612,5000,1004,'Name4',94612
NULL,'NULL',NULL,NULL,1005,'Name5',94613
NULL,'NULL',NULL,NULL,1006,'Name6',94613
NULL,'NULL',NULL,NULL,1007,'Name7',94614
NULL,'NULL',NULL,NULL,1008,'Name8',94614
NULL,'NULL',NULL,NULL,1009,'Name9',94615
NULL,'NULL',NULL,NULL,1010,'Name10',94615
---- TYPES
bigint, string, int, int, bigint, string, int
====
---- QUERY
select j.*, d.*
from JoinTbl j full outer join DimTbl d on (j.test_zip = d.zip)
---- RESULTS
1001,'Name1',94611,5000,1001,'Name1',94611
1001,'Name1',94611,5000,1002,'Name2',94611
1002,'Name2',94611,5000,1001,'Name1',94611
1002,'Name2',94611,5000,1002,'Name2',94611
1003,'Name3',94611,5000,1001,'Name1',94611
1003,'Name3',94611,5000,1002,'Name2',94611
1004,'Name4',94611,5000,1001,'Name1',94611
1004,'Name4',94611,5000,1002,'Name2',94611
1005,'Name5',94611,5000,1001,'Name1',94611
1005,'Name5',94611,5000,1002,'Name2',94611
1006,'Name16',94612,15000,1003,'Name3',94612
1006,'Name16',94612,15000,1004,'Name4',94612
1006,'Name16',94612,5000,1003,'Name3',94612
1006,'Name16',94612,5000,1004,'Name4',94612
1006,'Name16',94616,15000,NULL,'NULL',NULL
1006,'Name16',94616,5000,NULL,'NULL',NULL
1006,'Name6',94616,15000,NULL,'NULL',NULL
1006,'Name6',94616,5000,NULL,'NULL',NULL
1106,'Name16',94612,15000,1003,'Name3',94612
1106,'Name16',94612,15000,1004,'Name4',94612
1106,'Name16',94612,5000,1003,'Name3',94612
1106,'Name16',94612,5000,1004,'Name4',94612
1106,'Name16',94616,15000,NULL,'NULL',NULL
1106,'Name16',94616,5000,NULL,'NULL',NULL
1106,'Name6',94612,15000,1003,'Name3',94612
1106,'Name6',94612,15000,1004,'Name4',94612
1106,'Name6',94612,5000,1003,'Name3',94612
1106,'Name6',94612,5000,1004,'Name4',94612
1106,'Name6',94616,15000,NULL,'NULL',NULL
1106,'Name6',94616,5000,NULL,'NULL',NULL
NULL,'NULL',NULL,NULL,1005,'Name5',94613
NULL,'NULL',NULL,NULL,1006,'Name6',94613
NULL,'NULL',NULL,NULL,1007,'Name7',94614
NULL,'NULL',NULL,NULL,1008,'Name8',94614
NULL,'NULL',NULL,NULL,1009,'Name9',94615
NULL,'NULL',NULL,NULL,1010,'Name10',94615
---- TYPES
bigint, string, int, int, bigint, string, int
====
---- QUERY
# semi-join on bigint
select d.*
from DimTbl d left semi join JoinTbl j on (d.id = j.test_id)
---- RESULTS
1001,'Name1',94611
1002,'Name2',94611
1003,'Name3',94612
1004,'Name4',94612
1005,'Name5',94613
1006,'Name6',94613
---- TYPES
bigint, string, int
====
---- QUERY
# semi-join on string
select d.*
from DimTbl d left semi join JoinTbl j on (j.test_name = d.name)
---- RESULTS
1001,'Name1',94611
1002,'Name2',94611
1003,'Name3',94612
1004,'Name4',94612
1005,'Name5',94613
1006,'Name6',94613
---- TYPES
bigint, string, int
====
---- QUERY
# semi-join on int
select d.*
from DimTbl d left semi join JoinTbl j on (j.test_zip = d.zip)
---- RESULTS
1001,'Name1',94611
1002,'Name2',94611
1003,'Name3',94612
1004,'Name4',94612
---- TYPES
bigint, string, int
====
---- QUERY
# joins on empty tables
select * from emptytable t1 full outer join emptytable t2 on (t1.field=t2.field)
---- RESULTS
---- TYPES
string, int, string, int
====
---- QUERY
select count(*) from emptytable t1 right outer join greptiny t2 on (t1.field=t2.field)
---- RESULTS
100
---- TYPES
bigint
====
---- QUERY
select count(*) from greptiny t1 left outer join emptytable t2 on (t1.field=t2.field)
---- RESULTS
100
---- TYPES
bigint
====
---- QUERY
# test nested joins
select a.id, b.id, c.id, a.day, b.day, c.month, a.month, b.month
from alltypesagg a join alltypesagg b on
(a.id = b.id and a.month = b.day and b.month = 1 and b.month = b.day and a.day = b.day)
left outer join alltypessmall c on
(c.id = a.id and a.month = c.id and a.month=c.month)
where a.id < 10
---- RESULTS
0,0,NULL,1,1,NULL,1,1
1,1,1,1,1,1,1,1
2,2,NULL,1,1,NULL,1,1
3,3,NULL,1,1,NULL,1,1
4,4,NULL,1,1,NULL,1,1
5,5,NULL,1,1,NULL,1,1
6,6,NULL,1,1,NULL,1,1
7,7,NULL,1,1,NULL,1,1
8,8,NULL,1,1,NULL,1,1
9,9,NULL,1,1,NULL,1,1
---- TYPES
int, int, int, int, int, int, int, int
====
---- QUERY
# test full outer join where the RHS is empty and the LHS has a very low selectivity
# test query filed in IMP-791
SELECT a.string_col ts2
FROM alltypes a
FULL OUTER JOIN (
select * from alltypessmall where id < 0
) b
ON a.id=b.id AND a.id = 1
ORDER BY ts2 DESC LIMIT 10;
---- RESULTS
'1'
---- TYPES
string
====
---- QUERY
# test nullable expressions from inline views in left outer join
select x.id, y.a, y.b, y.id from alltypestiny x left outer join
(select 10 as a, case when id is null then 11 else 12 end as b, id from alltypestiny)
y on x.id = (y.id % 2)
order by x.id, y.id limit 100
---- RESULTS
0,10,12,0
0,10,12,2
0,10,12,4
0,10,12,6
1,10,12,1
1,10,12,3
1,10,12,5
1,10,12,7
2,NULL,NULL,NULL
3,NULL,NULL,NULL
4,NULL,NULL,NULL
5,NULL,NULL,NULL
6,NULL,NULL,NULL
7,NULL,NULL,NULL
---- TYPES
int, tinyint, tinyint, int
====
---- QUERY
# test nullable expressions from inline views in full outer join
select x.a, x.b, x.id, y.a, y.b, y.id from
(select 10 as a, case when id is null then 11 else 12 end as b, id from alltypestiny) x
full outer join
(select 20 as a, case when id is null then 21 else 22 end as b, id from alltypestiny) y on x.id = (y.id + 4)
order by x.id, y.id limit 100
---- RESULTS
10,12,0,NULL,NULL,NULL
10,12,1,NULL,NULL,NULL
10,12,2,NULL,NULL,NULL
10,12,3,NULL,NULL,NULL
10,12,4,20,22,0
10,12,5,20,22,1
10,12,6,20,22,2
10,12,7,20,22,3
NULL,NULL,NULL,20,22,4
NULL,NULL,NULL,20,22,5
NULL,NULL,NULL,20,22,6
NULL,NULL,NULL,20,22,7
---- TYPES
tinyint, tinyint, int, tinyint, tinyint, int
====
---- QUERY
# test nullable expressions wrapped multiple times
select z.xa, z.xid, z.ya, z.yid, k.a, k.id from
(select x.a as xa, x.id as xid, y.a as ya, y.id as yid from
(select 10 as a, id from alltypestiny where id = 1) x
full outer join
(select 20 as a, id from alltypestiny where id = 1) y on x.id = (y.id + 2)
) z
full outer join
(select 30 as a, id from alltypestiny where id = 1) k on z.xid = (k.id + 3)
order by z.xid, z.yid, k.id limit 100
---- RESULTS
10,1,NULL,NULL,NULL,NULL
NULL,NULL,20,1,NULL,NULL
NULL,NULL,NULL,NULL,30,1
---- TYPES
tinyint, int, tinyint, int, tinyint, int
====
---- QUERY
# right outer join requires the join op to be partitioned, otherwise non-matches cause
# duplicates
select count(*)
from functional.alltypesagg a
right outer join functional.alltypestiny b on (a.tinyint_col = b.id)
where a.tinyint_col is null
---- RESULTS
1
---- TYPES
bigint
====
---- QUERY
# same for full outer joins
select count(*)
from functional.alltypesagg a
full outer join functional.alltypestiny b on (a.tinyint_col = b.id)
where a.tinyint_col is null
---- RESULTS
2001
---- TYPES
bigint
====
---- QUERY
# test multiple outer joins with an inline view to check that nullable tuples
# are properly sent over the network
select z.xid, z.yid, k.id from
(select x.id as xid, y.id as yid from
(select id from alltypestiny where id = 1) x
full outer join
(select id from alltypestiny where id = 1) y on x.id = (y.id + 2)
) z
full outer join
(select id from alltypestiny where id = 1) k on z.xid = (k.id + 3)
order by z.xid, z.yid, k.id limit 100
---- RESULTS
1,NULL,NULL
NULL,1,NULL
NULL,NULL,1
---- TYPES
int, int, int
====
---- QUERY
# test that right outer join includes tuples from rhs
# even if one of its join columns is NULL
select count(*) from functional.alltypesagg a
right outer join functional.alltypesagg b on a.int_col = b.int_col
where b.int_col is null
---- RESULTS
20
---- TYPES
bigint
====
---- QUERY
# test that full outer join includes tuples from rhs
# even if one of its join columns is NULL
select count(*) from functional.alltypesagg a
full outer join functional.alltypesagg b on a.int_col = b.int_col
where a.int_col is null or b.int_col is null
---- RESULTS
40
---- TYPES
bigint
====
---- QUERY
# Regression test for IMPALA-676, which exposed a bug in our codegen subexpresssion
# elimination logic.
select count(*) from alltypesagg a
left outer join alltypesagg b
on (a.id = b.id
and (a.int_col = b.int_col + 10000 or (a.int_col is null and b.int_col is null)))
where b.id is not null
---- RESULTS
40
---- TYPES
bigint
====
---- QUERY
# Regression test for IMPALA-735.
select distinct t1.tinyint_col from alltypesagg t1
full outer join alltypesagg t2
on t2.smallint_col = (t1.tinyint_col + 10000)
---- RESULTS
NULL
1
2
3
4
5
6
7
8
9
---- TYPES
tinyint
====
---- QUERY
# Regression test for IMPALA-904. Tests correct execution of exprs from an outer-joined
# inline view that can evaluate to a non-NULL value with NULL-valued slots. Use an
# explicit [shuffle] hint for extra coverage because the expr will also be evaluated in
# a hashing data sink.
select count(*) from functional.alltypestiny t1 left outer join [shuffle]
(select zeroifnull(int_col) as id from functional.alltypessmall) t2 on (t1.id = t2.id)
---- RESULTS
8
---- TYPES
bigint
====