Files
impala/testdata/workloads/functional-query/queries/QueryTest/outer-joins.test
Alex Behm 1497002013 Added SHOW TABLE/COLUMN STATS command.
Fixed the following stats-related bugs:
- Per-partition row count was not distributed properly via CatalogService
- HBase column stats were not loaded and distributed properly

Enhancements to test framework:
- Allow regex specification of expected row or column values
- Fixed expected results of some tests because the test framework
  did not catch that they were incorrect

Change-Id: I1fa8e710bbcf0ddb62b961fdd26ecd9ce7b75d51
Reviewed-on: http://gerrit.ent.cloudera.com:8080/813
Reviewed-by: Alex Behm <alex.behm@cloudera.com>
Tested-by: jenkins
2014-01-08 10:53:51 -08:00

586 lines
18 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)
---- TYPES
string, string
---- RESULTS
'Name1','Name1'
'Name16','Name6'
'Name16','Name6'
'Name16','Name6'
'Name16','Name6'
'Name2','Name2'
'Name3','Name3'
'Name4','Name4'
'Name5','Name5'
'Name6','Name6'
'Name6','Name6'
====
---- QUERY
# join on bigint
select j.*, d.*
from JoinTbl j inner join DimTbl d on (j.test_id = d.id)
---- TYPES
bigint, string, int, int, bigint, string, int
---- 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
====
---- QUERY
select j.*, d.*
from JoinTbl j left outer join DimTbl d on (j.test_id = d.id)
---- TYPES
bigint, string, int, int, bigint, string, int
---- 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
====
---- QUERY
select j.*, d.*
from JoinTbl j right outer join DimTbl d on (j.test_id = d.id)
---- TYPES
bigint, string, int, int, bigint, string, int
---- 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
====
---- QUERY
select j.*, d.*
from JoinTbl j full outer join DimTbl d on (j.test_id = d.id)
---- TYPES
bigint, string, int, int, bigint, string, int
---- 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
====
---- QUERY
# join on string
select j.*, d.*
from JoinTbl j inner join DimTbl d on (j.test_name = d.name)
---- TYPES
bigint, string, int, int, bigint, string, int
---- 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
====
---- QUERY
select j.*, d.*
from JoinTbl j left outer join DimTbl d on (j.test_name = d.name)
---- TYPES
bigint, string, int, int, bigint, string, int
---- 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
====
---- QUERY
select j.*, d.*
from JoinTbl j right outer join DimTbl d on (j.test_name = d.name)
---- TYPES
bigint, string, int, int, bigint, string, int
---- 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
====
---- QUERY
select j.*, d.*
from JoinTbl j full outer join DimTbl d on (j.test_name = d.name)
---- TYPES
bigint, string, int, int, bigint, string, int
---- 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
====
---- QUERY
# join on int
select j.*, d.*
from JoinTbl j inner join DimTbl d on (j.test_zip = d.zip)
---- TYPES
bigint, string, int, int, bigint, string, int
---- 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
====
---- QUERY
select j.*, d.*
from JoinTbl j left outer join DimTbl d on (j.test_zip = d.zip)
---- TYPES
bigint, string, int, int, bigint, string, int
---- 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
====
---- QUERY
select j.*, d.*
from JoinTbl j right outer join DimTbl d on (j.test_zip = d.zip)
---- TYPES
bigint, string, int, int, bigint, string, int
---- 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
====
---- QUERY
select j.*, d.*
from JoinTbl j full outer join DimTbl d on (j.test_zip = d.zip)
---- TYPES
bigint, string, int, int, bigint, string, int
---- 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
====
---- QUERY
# semi-join on bigint
select d.*
from DimTbl d left semi join JoinTbl j on (d.id = j.test_id)
---- TYPES
bigint, string, int
---- RESULTS
1001,'Name1',94611
1002,'Name2',94611
1003,'Name3',94612
1004,'Name4',94612
1005,'Name5',94613
1006,'Name6',94613
====
---- QUERY
# semi-join on string
select d.*
from DimTbl d left semi join JoinTbl j on (j.test_name = d.name)
---- TYPES
bigint, string, int
---- RESULTS
1001,'Name1',94611
1002,'Name2',94611
1003,'Name3',94612
1004,'Name4',94612
1005,'Name5',94613
1006,'Name6',94613
====
---- QUERY
# semi-join on int
select d.*
from DimTbl d left semi join JoinTbl j on (j.test_zip = d.zip)
---- TYPES
bigint, string, int
---- RESULTS
1001,'Name1',94611
1002,'Name2',94611
1003,'Name3',94612
1004,'Name4',94612
====
---- QUERY
# joins on empty tables
select * from emptytable t1 full outer join emptytable t2 on (t1.field=t2.field)
---- TYPES
string, int, string, int
---- RESULTS
====
---- QUERY
select count(*) from emptytable t1 right outer join greptiny t2 on (t1.field=t2.field)
---- TYPES
bigint
---- RESULTS
100
====
---- QUERY
select count(*) from greptiny t1 left outer join emptytable t2 on (t1.field=t2.field)
---- TYPES
bigint
---- RESULTS
100
====
---- 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
---- TYPES
int, int, int, int, int, int, int, int
---- 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
====
---- 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;
---- TYPES
string
---- RESULTS
'1'
====
---- 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
---- TYPES
int, tinyint, tinyint, int
---- 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
====
---- 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
---- TYPES
tinyint, tinyint, int, tinyint, tinyint, int
---- 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
====
---- 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
---- TYPES
tinyint, int, tinyint, int, tinyint, int
---- RESULTS
10,1,NULL,NULL,NULL,NULL
NULL,NULL,20,1,NULL,NULL
NULL,NULL,NULL,NULL,30,1
====
---- 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
---- TYPES
bigint
---- RESULTS
1
====
---- 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
---- TYPES
bigint
---- RESULTS
1001
====
---- 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
---- TYPES
int, int, int
---- RESULTS
1,NULL,NULL
NULL,1,NULL
NULL,NULL,1
====
---- 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
---- TYPES
bigint
---- RESULTS
10
====
---- 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
---- TYPES
bigint
---- RESULTS
20
====