Files
impala/testdata/workloads/functional-query/queries/QueryTest/outer-joins.test
Lenni Kuff 04edc8f534 Update benchmark tests to run against generic workload, data loading with scale factor, +more
This change updates the run-benchmark script to enable it to target one or more
workloads. Now benchmarks can be run like:

./run-benchmark --workloads=hive-benchmark,tpch

We lookup the workload in the workloads directory, then read the associated
query .test files and start executing them.

To ensure the queries are not duplicated between benchmark and query tests, I
moved all existing queries (under fe/src/test/resources/* to the workloads
directory. You do NOT need to look through all the .test files, I've just moved
them. The one new file is the 'hive-benchmark.test' which contains the hive
benchmark queries.

Also added support for generating schema for different scale factors as well as
executing against these scale factors. For example, let's say we have a dataset
with a scale factor called "SF1". We would first generate the schema using:

./generate_schema_statements --workload=<workload> --scale_factor="SF3"
This will create tables with a unique names from the other scale factors.

Run the generated .sql file to load the data. Alternatively, the data can loaded
by running a new python script:
./bin/load-data.py -w <workload1>,<workload2> -e <exploration strategy> -s [scale factor]
For example: load-data.sh -w tpch -e core -s SF3

Then run against this:
./run-benchmark --workloads=<workload> --scale_factor=SF3

This changeset also includes a few other minor tweaks to some of the test
scripts.

Change-Id: Ife8a8d91567d75c9612be37bec96c1e7780f50d6
2014-01-08 10:44:22 -08:00

421 lines
14 KiB
Plaintext

# 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'
====
# 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
====
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
====
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
====
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
====
# 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
====
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
====
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
====
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
====
# 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
====
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
====
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
====
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
====
# 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
====
# 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
====
# 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
====
# joins on empty tables
select * from emptytable t1 full outer join emptytable t2 on (t1.field=t2.field)
---- TYPES
int, string, int, string
---- RESULTS
====
select * from emptytable t1 right outer join greptiny t2 on (t1.field=t2.field)
---- TYPES
int, string, string
---- RESULTS
====
select count(*) from greptiny t1 left outer join emptytable t2 on (t1.field=t2.field)
---- TYPES
bigint
---- RESULTS
100
====
# 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
====