mirror of
https://github.com/apache/impala.git
synced 2026-01-03 06:00:52 -05:00
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
672 lines
30 KiB
Plaintext
672 lines
30 KiB
Plaintext
// Showing contents of alltypestiny for convenience
|
|
select * from alltypestiny
|
|
---- TYPES
|
|
int, int, int, boolean, tinyint, smallint, int, bigint, float, double, string, string, timestamp
|
|
---- RESULTS
|
|
2009,1,0,true,0,0,0,0,0,0,'01/01/09','0',2009-01-01 00:00:00
|
|
2009,1,1,false,1,1,1,10,1.100000023841858,10.1,'01/01/09','1',2009-01-01 00:01:00
|
|
2009,2,2,true,0,0,0,0,0,0,'02/01/09','0',2009-02-01 00:00:00
|
|
2009,2,3,false,1,1,1,10,1.100000023841858,10.1,'02/01/09','1',2009-02-01 00:01:00
|
|
2009,3,4,true,0,0,0,0,0,0,'03/01/09','0',2009-03-01 00:00:00
|
|
2009,3,5,false,1,1,1,10,1.100000023841858,10.1,'03/01/09','1',2009-03-01 00:01:00
|
|
2009,4,6,true,0,0,0,0,0,0,'04/01/09','0',2009-04-01 00:00:00
|
|
2009,4,7,false,1,1,1,10,1.100000023841858,10.1,'04/01/09','1',2009-04-01 00:01:00
|
|
====
|
|
// Only UNION ALL, no nested unions
|
|
select * from alltypestiny where year=2009 and month=1
|
|
union all
|
|
select * from alltypestiny where year=2009 and month=1
|
|
union all
|
|
select * from alltypestiny where year=2009 and month=2
|
|
---- TYPES
|
|
int, int, int, boolean, tinyint, smallint, int, bigint, float, double, string, string, timestamp
|
|
---- RESULTS
|
|
2009,1,0,true,0,0,0,0,0,0,'01/01/09','0',2009-01-01 00:00:00
|
|
2009,1,0,true,0,0,0,0,0,0,'01/01/09','0',2009-01-01 00:00:00
|
|
2009,1,1,false,1,1,1,10,1.100000023841858,10.1,'01/01/09','1',2009-01-01 00:01:00
|
|
2009,1,1,false,1,1,1,10,1.100000023841858,10.1,'01/01/09','1',2009-01-01 00:01:00
|
|
2009,2,2,true,0,0,0,0,0,0,'02/01/09','0',2009-02-01 00:00:00
|
|
2009,2,3,false,1,1,1,10,1.100000023841858,10.1,'02/01/09','1',2009-02-01 00:01:00
|
|
====
|
|
// Only UNION ALL with limit inside operands. One of the operands also has an order by.
|
|
select * from alltypestiny where year=2009 and month=1 limit 1
|
|
union all
|
|
select * from alltypestiny where year=2009 and month=1 order by int_col limit 1
|
|
union all
|
|
select * from alltypestiny where year=2009 and month=2 limit 1
|
|
---- TYPES
|
|
int, int, int, boolean, tinyint, smallint, int, bigint, float, double, string, string, timestamp
|
|
---- RESULTS
|
|
2009,1,0,true,0,0,0,0,0,0,'01/01/09','0',2009-01-01 00:00:00
|
|
2009,1,0,true,0,0,0,0,0,0,'01/01/09','0',2009-01-01 00:00:00
|
|
2009,2,2,true,0,0,0,0,0,0,'02/01/09','0',2009-02-01 00:00:00
|
|
====
|
|
// Only UNION DISTINCT, no nested unions
|
|
select * from alltypestiny where year=2009 and month=1
|
|
union distinct
|
|
select * from alltypestiny where year=2009 and month=1
|
|
union distinct
|
|
select * from alltypestiny where year=2009 and month=2
|
|
---- TYPES
|
|
int, int, int, boolean, tinyint, smallint, int, bigint, float, double, string, string, timestamp
|
|
---- RESULTS
|
|
2009,1,0,true,0,0,0,0,0,0,'01/01/09','0',2009-01-01 00:00:00
|
|
2009,1,1,false,1,1,1,10,1.100000023841858,10.1,'01/01/09','1',2009-01-01 00:01:00
|
|
2009,2,2,true,0,0,0,0,0,0,'02/01/09','0',2009-02-01 00:00:00
|
|
2009,2,3,false,1,1,1,10,1.100000023841858,10.1,'02/01/09','1',2009-02-01 00:01:00
|
|
====
|
|
// Only UNION ALL, mixed selects with and without from clauses, no nested unions
|
|
select * from alltypestiny where year=2009 and month=1
|
|
union all
|
|
select 2009,1,0,true,0,0,0,0,0,0,'01/01/09','0',cast('2009-01-01 00:00:00' as timestamp)
|
|
union all
|
|
select * from alltypestiny where year=2009 and month=1
|
|
union all
|
|
select 2009,1,1,false,1,1,1,10,1.1,10.1,'01/01/09','1',cast('2009-01-01 00:01:00' as timestamp)
|
|
---- TYPES
|
|
int, int, int, boolean, tinyint, smallint, int, bigint, double, double, string, string, timestamp
|
|
---- RESULTS
|
|
2009,1,0,true,0,0,0,0,0,0,'01/01/09','0',2009-01-01 00:00:00
|
|
2009,1,0,true,0,0,0,0,0,0,'01/01/09','0',2009-01-01 00:00:00
|
|
2009,1,0,true,0,0,0,0,0,0,'01/01/09','0',2009-01-01 00:00:00
|
|
2009,1,1,false,1,1,1,10,1.1,10.1,'01/01/09','1',2009-01-01 00:01:00
|
|
2009,1,1,false,1,1,1,10,1.100000023841858,10.1,'01/01/09','1',2009-01-01 00:01:00
|
|
2009,1,1,false,1,1,1,10,1.100000023841858,10.1,'01/01/09','1',2009-01-01 00:01:00
|
|
====
|
|
// Only UNION DISTINCT, mixed selects with and without from clauses, no nested unions
|
|
select * from alltypestiny where year=2009 and month=1
|
|
union distinct
|
|
select 2009,1,0,true,0,0,0,0,cast(0 as float),0,'01/01/09','0',cast('2009-01-01 00:00:00' as timestamp)
|
|
union distinct
|
|
select * from alltypestiny where year=2009 and month=1
|
|
union distinct
|
|
select 2009,1,1,false,1,1,1,10,cast(1.1 as float),10.1,'01/01/09','1',cast('2009-01-01 00:01:00' as timestamp)
|
|
---- TYPES
|
|
int, int, int, boolean, tinyint, smallint, int, bigint, float, double, string, string, timestamp
|
|
---- RESULTS
|
|
2009,1,0,true,0,0,0,0,0,0,'01/01/09','0',2009-01-01 00:00:00
|
|
2009,1,1,false,1,1,1,10,1.100000023841858,10.1,'01/01/09','1',2009-01-01 00:01:00
|
|
====
|
|
// Mixed UNION ALL/DISTINCT but effectively only UNION DISTINCT, no nested unions,
|
|
// with order by and limit
|
|
select * from alltypestiny where year=2009 and month=1
|
|
union all
|
|
select * from alltypestiny where year=2009 and month=1
|
|
union all
|
|
select * from alltypestiny where year=2009 and month=2
|
|
union distinct
|
|
(select * from alltypestiny where year=2009 and month=2)
|
|
order by 3 limit 3
|
|
---- TYPES
|
|
int, int, int, boolean, tinyint, smallint, int, bigint, float, double, string, string, timestamp
|
|
---- RESULTS
|
|
2009,1,0,true,0,0,0,0,0,0,'01/01/09','0',2009-01-01 00:00:00
|
|
2009,1,1,false,1,1,1,10,1.100000023841858,10.1,'01/01/09','1',2009-01-01 00:01:00
|
|
2009,2,2,true,0,0,0,0,0,0,'02/01/09','0',2009-02-01 00:00:00
|
|
====
|
|
// Mixed UNION ALL/DISTINCT, no nested unions, with order by and limit
|
|
select * from alltypestiny where year=2009 and month=1
|
|
union distinct
|
|
select * from alltypestiny where year=2009 and month=1
|
|
union all
|
|
select * from alltypestiny where year=2009 and month=2
|
|
union all
|
|
(select * from alltypestiny where year=2009 and month=2)
|
|
order by 3,4 limit 3
|
|
---- TYPES
|
|
int, int, int, boolean, tinyint, smallint, int, bigint, float, double, string, string, timestamp
|
|
---- RESULTS
|
|
2009,1,0,true,0,0,0,0,0,0,'01/01/09','0',2009-01-01 00:00:00
|
|
2009,1,1,false,1,1,1,10,1.100000023841858,10.1,'01/01/09','1',2009-01-01 00:01:00
|
|
2009,2,2,true,0,0,0,0,0,0,'02/01/09','0',2009-02-01 00:00:00
|
|
====
|
|
// Mixed UNION ALL/DISTINCT, no nested unions, with order by and limit
|
|
select * from alltypestiny where year=2009 and month=1
|
|
union all
|
|
select * from alltypestiny where year=2009 and month=1
|
|
union distinct
|
|
select * from alltypestiny where year=2009 and month=2
|
|
union all
|
|
(select * from alltypestiny where year=2009 and month=2)
|
|
order by 3,4 limit 4
|
|
---- TYPES
|
|
int, int, int, boolean, tinyint, smallint, int, bigint, float, double, string, string, timestamp
|
|
---- RESULTS
|
|
2009,1,0,true,0,0,0,0,0,0,'01/01/09','0',2009-01-01 00:00:00
|
|
2009,1,1,false,1,1,1,10,1.100000023841858,10.1,'01/01/09','1',2009-01-01 00:01:00
|
|
2009,2,2,true,0,0,0,0,0,0,'02/01/09','0',2009-02-01 00:00:00
|
|
2009,2,2,true,0,0,0,0,0,0,'02/01/09','0',2009-02-01 00:00:00
|
|
====
|
|
// Union unnesting: Only UNION ALL, first operand is nested
|
|
(select * from alltypestiny where year=2009 and month=1
|
|
union all
|
|
select * from alltypestiny where year=2009 and month=2)
|
|
union all
|
|
select * from alltypestiny where year=2009 and month=1
|
|
---- TYPES
|
|
int, int, int, boolean, tinyint, smallint, int, bigint, float, double, string, string, timestamp
|
|
---- RESULTS
|
|
2009,1,0,true,0,0,0,0,0,0,'01/01/09','0',2009-01-01 00:00:00
|
|
2009,1,0,true,0,0,0,0,0,0,'01/01/09','0',2009-01-01 00:00:00
|
|
2009,1,1,false,1,1,1,10,1.100000023841858,10.1,'01/01/09','1',2009-01-01 00:01:00
|
|
2009,1,1,false,1,1,1,10,1.100000023841858,10.1,'01/01/09','1',2009-01-01 00:01:00
|
|
2009,2,2,true,0,0,0,0,0,0,'02/01/09','0',2009-02-01 00:00:00
|
|
2009,2,3,false,1,1,1,10,1.100000023841858,10.1,'02/01/09','1',2009-02-01 00:01:00
|
|
====
|
|
// Union unnesting: Only UNION ALL, second operand is nested
|
|
select * from alltypestiny where year=2009 and month=1
|
|
union all
|
|
(select * from alltypestiny where year=2009 and month=1
|
|
union all
|
|
select * from alltypestiny where year=2009 and month=2)
|
|
---- TYPES
|
|
int, int, int, boolean, tinyint, smallint, int, bigint, float, double, string, string, timestamp
|
|
---- RESULTS
|
|
2009,1,0,true,0,0,0,0,0,0,'01/01/09','0',2009-01-01 00:00:00
|
|
2009,1,0,true,0,0,0,0,0,0,'01/01/09','0',2009-01-01 00:00:00
|
|
2009,1,1,false,1,1,1,10,1.100000023841858,10.1,'01/01/09','1',2009-01-01 00:01:00
|
|
2009,1,1,false,1,1,1,10,1.100000023841858,10.1,'01/01/09','1',2009-01-01 00:01:00
|
|
2009,2,2,true,0,0,0,0,0,0,'02/01/09','0',2009-02-01 00:00:00
|
|
2009,2,3,false,1,1,1,10,1.100000023841858,10.1,'02/01/09','1',2009-02-01 00:01:00
|
|
====
|
|
// Union unnesting: Only UNION DISTINCT, first operand is nested
|
|
(select * from alltypestiny where year=2009 and month=1
|
|
union distinct
|
|
select * from alltypestiny where year=2009 and month=2)
|
|
union distinct
|
|
select * from alltypestiny where year=2009 and month=1
|
|
---- TYPES
|
|
int, int, int, boolean, tinyint, smallint, int, bigint, float, double, string, string, timestamp
|
|
---- RESULTS
|
|
2009,1,0,true,0,0,0,0,0,0,'01/01/09','0',2009-01-01 00:00:00
|
|
2009,1,1,false,1,1,1,10,1.100000023841858,10.1,'01/01/09','1',2009-01-01 00:01:00
|
|
2009,2,2,true,0,0,0,0,0,0,'02/01/09','0',2009-02-01 00:00:00
|
|
2009,2,3,false,1,1,1,10,1.100000023841858,10.1,'02/01/09','1',2009-02-01 00:01:00
|
|
====
|
|
// Union unnesting: Only UNION DISTINCT, second operand is nested
|
|
select * from alltypestiny where year=2009 and month=1
|
|
union distinct
|
|
(select * from alltypestiny where year=2009 and month=1
|
|
union distinct
|
|
select * from alltypestiny where year=2009 and month=2)
|
|
---- TYPES
|
|
int, int, int, boolean, tinyint, smallint, int, bigint, float, double, string, string, timestamp
|
|
---- RESULTS
|
|
2009,1,0,true,0,0,0,0,0,0,'01/01/09','0',2009-01-01 00:00:00
|
|
2009,1,1,false,1,1,1,10,1.100000023841858,10.1,'01/01/09','1',2009-01-01 00:01:00
|
|
2009,2,2,true,0,0,0,0,0,0,'02/01/09','0',2009-02-01 00:00:00
|
|
2009,2,3,false,1,1,1,10,1.100000023841858,10.1,'02/01/09','1',2009-02-01 00:01:00
|
|
====
|
|
// Union unnesting: UNION ALL doesn't absorb nested union with DISTINCT,
|
|
// first operand is nested
|
|
(select * from alltypestiny where year=2009 and month=1
|
|
union distinct
|
|
select * from alltypestiny where year=2009 and month=2)
|
|
union all
|
|
select * from alltypestiny where year=2009 and month=1
|
|
---- TYPES
|
|
int, int, int, boolean, tinyint, smallint, int, bigint, float, double, string, string, timestamp
|
|
---- RESULTS
|
|
2009,1,0,true,0,0,0,0,0,0,'01/01/09','0',2009-01-01 00:00:00
|
|
2009,1,0,true,0,0,0,0,0,0,'01/01/09','0',2009-01-01 00:00:00
|
|
2009,1,1,false,1,1,1,10,1.100000023841858,10.1,'01/01/09','1',2009-01-01 00:01:00
|
|
2009,1,1,false,1,1,1,10,1.100000023841858,10.1,'01/01/09','1',2009-01-01 00:01:00
|
|
2009,2,2,true,0,0,0,0,0,0,'02/01/09','0',2009-02-01 00:00:00
|
|
2009,2,3,false,1,1,1,10,1.100000023841858,10.1,'02/01/09','1',2009-02-01 00:01:00
|
|
====
|
|
// Union unnesting: UNION ALL doesn't absorb nested union with DISTINCT,
|
|
// second operand is nested
|
|
select * from alltypestiny where year=2009 and month=1
|
|
union all
|
|
(select * from alltypestiny where year=2009 and month=1
|
|
union distinct
|
|
select * from alltypestiny where year=2009 and month=2)
|
|
---- TYPES
|
|
int, int, int, boolean, tinyint, smallint, int, bigint, float, double, string, string, timestamp
|
|
---- RESULTS
|
|
2009,1,0,true,0,0,0,0,0,0,'01/01/09','0',2009-01-01 00:00:00
|
|
2009,1,0,true,0,0,0,0,0,0,'01/01/09','0',2009-01-01 00:00:00
|
|
2009,1,1,false,1,1,1,10,1.100000023841858,10.1,'01/01/09','1',2009-01-01 00:01:00
|
|
2009,1,1,false,1,1,1,10,1.100000023841858,10.1,'01/01/09','1',2009-01-01 00:01:00
|
|
2009,2,2,true,0,0,0,0,0,0,'02/01/09','0',2009-02-01 00:00:00
|
|
2009,2,3,false,1,1,1,10,1.100000023841858,10.1,'02/01/09','1',2009-02-01 00:01:00
|
|
====
|
|
// Union unnesting: UNION ALL absorbs the children but not directly the operands
|
|
// of a nested union with mixed ALL/DISTINCT, first operand is nested
|
|
(select * from alltypestiny where year=2009 and month=1
|
|
union distinct
|
|
select * from alltypestiny where year=2009 and month=2
|
|
union all
|
|
select * from alltypestiny where year=2009 and month=2)
|
|
union all
|
|
select * from alltypestiny where year=2009 and month=1
|
|
---- TYPES
|
|
int, int, int, boolean, tinyint, smallint, int, bigint, float, double, string, string, timestamp
|
|
---- RESULTS
|
|
2009,1,0,true,0,0,0,0,0,0,'01/01/09','0',2009-01-01 00:00:00
|
|
2009,1,0,true,0,0,0,0,0,0,'01/01/09','0',2009-01-01 00:00:00
|
|
2009,1,1,false,1,1,1,10,1.100000023841858,10.1,'01/01/09','1',2009-01-01 00:01:00
|
|
2009,1,1,false,1,1,1,10,1.100000023841858,10.1,'01/01/09','1',2009-01-01 00:01:00
|
|
2009,2,2,true,0,0,0,0,0,0,'02/01/09','0',2009-02-01 00:00:00
|
|
2009,2,2,true,0,0,0,0,0,0,'02/01/09','0',2009-02-01 00:00:00
|
|
2009,2,3,false,1,1,1,10,1.100000023841858,10.1,'02/01/09','1',2009-02-01 00:01:00
|
|
2009,2,3,false,1,1,1,10,1.100000023841858,10.1,'02/01/09','1',2009-02-01 00:01:00
|
|
====
|
|
// Union unnesting: UNION ALL absorbs the children but not directly the operands
|
|
// of a nested union with mixed ALL/DISTINCT, second operand is nested
|
|
select * from alltypestiny where year=2009 and month=1
|
|
union all
|
|
(select * from alltypestiny where year=2009 and month=1
|
|
union distinct
|
|
select * from alltypestiny where year=2009 and month=2
|
|
union all
|
|
select * from alltypestiny where year=2009 and month=2)
|
|
---- TYPES
|
|
int, int, int, boolean, tinyint, smallint, int, bigint, float, double, string, string, timestamp
|
|
---- RESULTS
|
|
2009,1,0,true,0,0,0,0,0,0,'01/01/09','0',2009-01-01 00:00:00
|
|
2009,1,0,true,0,0,0,0,0,0,'01/01/09','0',2009-01-01 00:00:00
|
|
2009,1,1,false,1,1,1,10,1.100000023841858,10.1,'01/01/09','1',2009-01-01 00:01:00
|
|
2009,1,1,false,1,1,1,10,1.100000023841858,10.1,'01/01/09','1',2009-01-01 00:01:00
|
|
2009,2,2,true,0,0,0,0,0,0,'02/01/09','0',2009-02-01 00:00:00
|
|
2009,2,2,true,0,0,0,0,0,0,'02/01/09','0',2009-02-01 00:00:00
|
|
2009,2,3,false,1,1,1,10,1.100000023841858,10.1,'02/01/09','1',2009-02-01 00:01:00
|
|
2009,2,3,false,1,1,1,10,1.100000023841858,10.1,'02/01/09','1',2009-02-01 00:01:00
|
|
====
|
|
// Union unnesting: UNION ALL doesn't absorb the children of a nested union
|
|
// with mixed ALL/DISTINCT and limit, second operand is nested
|
|
select * from alltypestiny where year=2009 and month=1
|
|
union all
|
|
(select * from alltypestiny where year=2009 and month=1
|
|
union distinct
|
|
select * from alltypestiny where year=2009 and month=2
|
|
union all
|
|
(select * from alltypestiny where year=2009 and month=2)
|
|
limit 10)
|
|
---- TYPES
|
|
int, int, int, boolean, tinyint, smallint, int, bigint, float, double, string, string, timestamp
|
|
---- RESULTS
|
|
2009,1,0,true,0,0,0,0,0,0,'01/01/09','0',2009-01-01 00:00:00
|
|
2009,1,0,true,0,0,0,0,0,0,'01/01/09','0',2009-01-01 00:00:00
|
|
2009,1,1,false,1,1,1,10,1.100000023841858,10.1,'01/01/09','1',2009-01-01 00:01:00
|
|
2009,1,1,false,1,1,1,10,1.100000023841858,10.1,'01/01/09','1',2009-01-01 00:01:00
|
|
2009,2,2,true,0,0,0,0,0,0,'02/01/09','0',2009-02-01 00:00:00
|
|
2009,2,2,true,0,0,0,0,0,0,'02/01/09','0',2009-02-01 00:00:00
|
|
2009,2,3,false,1,1,1,10,1.100000023841858,10.1,'02/01/09','1',2009-02-01 00:01:00
|
|
2009,2,3,false,1,1,1,10,1.100000023841858,10.1,'02/01/09','1',2009-02-01 00:01:00
|
|
====
|
|
// Union unnesting: UNION ALL doesn't absorb nested union with order by and limit,
|
|
// first operand is nested
|
|
(select * from alltypestiny where year=2009 and month=1
|
|
union all
|
|
(select * from alltypestiny where year=2009 and month=2)
|
|
order by 3 limit 3)
|
|
union all
|
|
select * from alltypestiny where year=2009 and month=1
|
|
---- TYPES
|
|
int, int, int, boolean, tinyint, smallint, int, bigint, float, double, string, string, timestamp
|
|
---- RESULTS
|
|
2009,1,0,true,0,0,0,0,0,0,'01/01/09','0',2009-01-01 00:00:00
|
|
2009,1,0,true,0,0,0,0,0,0,'01/01/09','0',2009-01-01 00:00:00
|
|
2009,1,1,false,1,1,1,10,1.100000023841858,10.1,'01/01/09','1',2009-01-01 00:01:00
|
|
2009,1,1,false,1,1,1,10,1.100000023841858,10.1,'01/01/09','1',2009-01-01 00:01:00
|
|
2009,2,2,true,0,0,0,0,0,0,'02/01/09','0',2009-02-01 00:00:00
|
|
====
|
|
// Union unnesting: UNION ALL doesn't absorb nested union with order by and limit,
|
|
// second operand is nested
|
|
select * from alltypestiny where year=2009 and month=1
|
|
union all
|
|
(select * from alltypestiny where year=2009 and month=1
|
|
union all
|
|
(select * from alltypestiny where year=2009 and month=2)
|
|
order by 3 limit 3)
|
|
---- TYPES
|
|
int, int, int, boolean, tinyint, smallint, int, bigint, float, double, string, string, timestamp
|
|
---- RESULTS
|
|
2009,1,0,true,0,0,0,0,0,0,'01/01/09','0',2009-01-01 00:00:00
|
|
2009,1,0,true,0,0,0,0,0,0,'01/01/09','0',2009-01-01 00:00:00
|
|
2009,1,1,false,1,1,1,10,1.100000023841858,10.1,'01/01/09','1',2009-01-01 00:01:00
|
|
2009,1,1,false,1,1,1,10,1.100000023841858,10.1,'01/01/09','1',2009-01-01 00:01:00
|
|
2009,2,2,true,0,0,0,0,0,0,'02/01/09','0',2009-02-01 00:00:00
|
|
====
|
|
// Union unnesting: UNION DISTINCT absorbs nested union with ALL
|
|
// first operand is nested
|
|
(select * from alltypestiny where year=2009 and month=1
|
|
union all
|
|
select * from alltypestiny where year=2009 and month=2)
|
|
union distinct
|
|
select * from alltypestiny where year=2009 and month=1
|
|
---- TYPES
|
|
int, int, int, boolean, tinyint, smallint, int, bigint, float, double, string, string, timestamp
|
|
---- RESULTS
|
|
2009,1,0,true,0,0,0,0,0,0,'01/01/09','0',2009-01-01 00:00:00
|
|
2009,1,1,false,1,1,1,10,1.100000023841858,10.1,'01/01/09','1',2009-01-01 00:01:00
|
|
2009,2,2,true,0,0,0,0,0,0,'02/01/09','0',2009-02-01 00:00:00
|
|
2009,2,3,false,1,1,1,10,1.100000023841858,10.1,'02/01/09','1',2009-02-01 00:01:00
|
|
====
|
|
// Union unnesting: UNION DISTINCT absorbs nested union with ALL,
|
|
// second operand is nested
|
|
select * from alltypestiny where year=2009 and month=1
|
|
union distinct
|
|
(select * from alltypestiny where year=2009 and month=1
|
|
union all
|
|
select * from alltypestiny where year=2009 and month=2)
|
|
---- TYPES
|
|
int, int, int, boolean, tinyint, smallint, int, bigint, float, double, string, string, timestamp
|
|
---- RESULTS
|
|
2009,1,0,true,0,0,0,0,0,0,'01/01/09','0',2009-01-01 00:00:00
|
|
2009,1,1,false,1,1,1,10,1.100000023841858,10.1,'01/01/09','1',2009-01-01 00:01:00
|
|
2009,2,2,true,0,0,0,0,0,0,'02/01/09','0',2009-02-01 00:00:00
|
|
2009,2,3,false,1,1,1,10,1.100000023841858,10.1,'02/01/09','1',2009-02-01 00:01:00
|
|
====
|
|
// Union unnesting: UNION DISTINCT absorbs nested union with mixed ALL/DISTINCT,
|
|
// first operand is nested
|
|
(select * from alltypestiny where year=2009 and month=1
|
|
union distinct
|
|
select * from alltypestiny where year=2009 and month=2
|
|
union all
|
|
select * from alltypestiny where year=2009 and month=2)
|
|
union distinct
|
|
select * from alltypestiny where year=2009 and month=1
|
|
---- TYPES
|
|
int, int, int, boolean, tinyint, smallint, int, bigint, float, double, string, string, timestamp
|
|
---- RESULTS
|
|
2009,1,0,true,0,0,0,0,0,0,'01/01/09','0',2009-01-01 00:00:00
|
|
2009,1,1,false,1,1,1,10,1.100000023841858,10.1,'01/01/09','1',2009-01-01 00:01:00
|
|
2009,2,2,true,0,0,0,0,0,0,'02/01/09','0',2009-02-01 00:00:00
|
|
2009,2,3,false,1,1,1,10,1.100000023841858,10.1,'02/01/09','1',2009-02-01 00:01:00
|
|
====
|
|
// Union unnesting: UNION DISTINCT absorbs nested union with mixed ALL/DISTINCT,
|
|
// second operand is nested
|
|
select * from alltypestiny where year=2009 and month=1
|
|
union distinct
|
|
(select * from alltypestiny where year=2009 and month=1
|
|
union distinct
|
|
select * from alltypestiny where year=2009 and month=2
|
|
union all
|
|
select * from alltypestiny where year=2009 and month=2)
|
|
---- TYPES
|
|
int, int, int, boolean, tinyint, smallint, int, bigint, float, double, string, string, timestamp
|
|
---- RESULTS
|
|
2009,1,0,true,0,0,0,0,0,0,'01/01/09','0',2009-01-01 00:00:00
|
|
2009,1,1,false,1,1,1,10,1.100000023841858,10.1,'01/01/09','1',2009-01-01 00:01:00
|
|
2009,2,2,true,0,0,0,0,0,0,'02/01/09','0',2009-02-01 00:00:00
|
|
2009,2,3,false,1,1,1,10,1.100000023841858,10.1,'02/01/09','1',2009-02-01 00:01:00
|
|
====
|
|
// Union unnesting: UNION DISTINCT doesn't absorb nested union with order by and limit,
|
|
// first operand is nested
|
|
(select * from alltypestiny where year=2009 and month=1
|
|
union all
|
|
(select * from alltypestiny where year=2009 and month=2)
|
|
order by 3 limit 3)
|
|
union distinct
|
|
select * from alltypestiny where year=2009 and month=1
|
|
---- TYPES
|
|
int, int, int, boolean, tinyint, smallint, int, bigint, float, double, string, string, timestamp
|
|
---- RESULTS
|
|
2009,1,0,true,0,0,0,0,0,0,'01/01/09','0',2009-01-01 00:00:00
|
|
2009,1,1,false,1,1,1,10,1.100000023841858,10.1,'01/01/09','1',2009-01-01 00:01:00
|
|
2009,2,2,true,0,0,0,0,0,0,'02/01/09','0',2009-02-01 00:00:00
|
|
====
|
|
// Union unnesting: UNION DISTINCT doesn't absorb nested union with order by and limit,
|
|
// first operand is nested
|
|
(select * from alltypestiny where year=2009 and month=1
|
|
union all
|
|
(select * from alltypestiny where year=2009 and month=2)
|
|
order by 3 limit 3)
|
|
union distinct
|
|
select * from alltypestiny where year=2009 and month=1
|
|
---- TYPES
|
|
int, int, int, boolean, tinyint, smallint, int, bigint, float, double, string, string, timestamp
|
|
---- RESULTS
|
|
2009,1,0,true,0,0,0,0,0,0,'01/01/09','0',2009-01-01 00:00:00
|
|
2009,1,1,false,1,1,1,10,1.100000023841858,10.1,'01/01/09','1',2009-01-01 00:01:00
|
|
2009,2,2,true,0,0,0,0,0,0,'02/01/09','0',2009-02-01 00:00:00
|
|
====
|
|
// Complex union unnesting: Multiple levels of UNION ALL, fully unnestable
|
|
select * from alltypestiny where year=2009 and month=1
|
|
union all
|
|
(select * from alltypestiny where year=2009 and month=1
|
|
union all
|
|
(select * from alltypestiny where year=2009 and month=2
|
|
union all
|
|
(select * from alltypestiny where year=2009 and month=2
|
|
union all
|
|
select * from alltypestiny where year=2009 and month=3)))
|
|
---- TYPES
|
|
int, int, int, boolean, tinyint, smallint, int, bigint, float, double, string, string, timestamp
|
|
---- RESULTS
|
|
2009,1,0,true,0,0,0,0,0,0,'01/01/09','0',2009-01-01 00:00:00
|
|
2009,1,0,true,0,0,0,0,0,0,'01/01/09','0',2009-01-01 00:00:00
|
|
2009,1,1,false,1,1,1,10,1.100000023841858,10.1,'01/01/09','1',2009-01-01 00:01:00
|
|
2009,1,1,false,1,1,1,10,1.100000023841858,10.1,'01/01/09','1',2009-01-01 00:01:00
|
|
2009,2,2,true,0,0,0,0,0,0,'02/01/09','0',2009-02-01 00:00:00
|
|
2009,2,2,true,0,0,0,0,0,0,'02/01/09','0',2009-02-01 00:00:00
|
|
2009,2,3,false,1,1,1,10,1.100000023841858,10.1,'02/01/09','1',2009-02-01 00:01:00
|
|
2009,2,3,false,1,1,1,10,1.100000023841858,10.1,'02/01/09','1',2009-02-01 00:01:00
|
|
2009,3,4,true,0,0,0,0,0,0,'03/01/09','0',2009-03-01 00:00:00
|
|
2009,3,5,false,1,1,1,10,1.100000023841858,10.1,'03/01/09','1',2009-03-01 00:01:00
|
|
====
|
|
// Complex union unnesting: Multiple levels of UNION DISTINCT, fully unnestable
|
|
select * from alltypestiny where year=2009 and month=1
|
|
union distinct
|
|
(select * from alltypestiny where year=2009 and month=1
|
|
union distinct
|
|
(select * from alltypestiny where year=2009 and month=2
|
|
union distinct
|
|
(select * from alltypestiny where year=2009 and month=2
|
|
union distinct
|
|
select * from alltypestiny where year=2009 and month=3)))
|
|
---- TYPES
|
|
int, int, int, boolean, tinyint, smallint, int, bigint, float, double, string, string, timestamp
|
|
---- RESULTS
|
|
2009,1,0,true,0,0,0,0,0,0,'01/01/09','0',2009-01-01 00:00:00
|
|
2009,1,1,false,1,1,1,10,1.100000023841858,10.1,'01/01/09','1',2009-01-01 00:01:00
|
|
2009,2,2,true,0,0,0,0,0,0,'02/01/09','0',2009-02-01 00:00:00
|
|
2009,2,3,false,1,1,1,10,1.100000023841858,10.1,'02/01/09','1',2009-02-01 00:01:00
|
|
2009,3,4,true,0,0,0,0,0,0,'03/01/09','0',2009-03-01 00:00:00
|
|
2009,3,5,false,1,1,1,10,1.100000023841858,10.1,'03/01/09','1',2009-03-01 00:01:00
|
|
====
|
|
// Complex union unnesting: Partially unnestable up to 2nd level
|
|
select * from alltypestiny where year=2009 and month=1
|
|
union all
|
|
(select * from alltypestiny where year=2009 and month=1
|
|
union distinct
|
|
(select * from alltypestiny where year=2009 and month=2
|
|
union all
|
|
(select * from alltypestiny where year=2009 and month=2
|
|
union distinct
|
|
(select * from alltypestiny where year=2009 and month=3)
|
|
order by 3 limit 3)))
|
|
---- TYPES
|
|
int, int, int, boolean, tinyint, smallint, int, bigint, float, double, string, string, timestamp
|
|
---- RESULTS
|
|
2009,1,0,true,0,0,0,0,0,0,'01/01/09','0',2009-01-01 00:00:00
|
|
2009,1,0,true,0,0,0,0,0,0,'01/01/09','0',2009-01-01 00:00:00
|
|
2009,1,1,false,1,1,1,10,1.100000023841858,10.1,'01/01/09','1',2009-01-01 00:01:00
|
|
2009,1,1,false,1,1,1,10,1.100000023841858,10.1,'01/01/09','1',2009-01-01 00:01:00
|
|
2009,2,2,true,0,0,0,0,0,0,'02/01/09','0',2009-02-01 00:00:00
|
|
2009,2,3,false,1,1,1,10,1.100000023841858,10.1,'02/01/09','1',2009-02-01 00:01:00
|
|
2009,3,4,true,0,0,0,0,0,0,'03/01/09','0',2009-03-01 00:00:00
|
|
====
|
|
// Complex union unnesting: Partially unnestable up to 1st level
|
|
select * from alltypestiny where year=2009 and month=1
|
|
union distinct
|
|
(select * from alltypestiny where year=2009 and month=1
|
|
union distinct
|
|
(select * from alltypestiny where year=2009 and month=2
|
|
union all
|
|
(select * from alltypestiny where year=2009 and month=2
|
|
union distinct
|
|
(select * from alltypestiny where year=2009 and month=3)
|
|
order by 3 limit 3)))
|
|
---- TYPES
|
|
int, int, int, boolean, tinyint, smallint, int, bigint, float, double, string, string, timestamp
|
|
---- RESULTS
|
|
2009,1,0,true,0,0,0,0,0,0,'01/01/09','0',2009-01-01 00:00:00
|
|
2009,1,1,false,1,1,1,10,1.100000023841858,10.1,'01/01/09','1',2009-01-01 00:01:00
|
|
2009,2,2,true,0,0,0,0,0,0,'02/01/09','0',2009-02-01 00:00:00
|
|
2009,2,3,false,1,1,1,10,1.100000023841858,10.1,'02/01/09','1',2009-02-01 00:01:00
|
|
2009,3,4,true,0,0,0,0,0,0,'03/01/09','0',2009-03-01 00:00:00
|
|
====
|
|
// Complex union unnesting: Multiple nested unions to test all rules in a single query
|
|
select * from alltypestiny where year=2009 and month=1
|
|
union distinct
|
|
(select * from alltypestiny where year=2009 and month=1
|
|
union all
|
|
select * from alltypestiny where year=2009 and month=2)
|
|
union distinct
|
|
(select * from alltypestiny where year=2009 and month=2
|
|
union all
|
|
(select * from alltypestiny where year=2009 and month=3)
|
|
order by 3 limit 3)
|
|
union all
|
|
(select * from alltypestiny where year=2009 and month=3
|
|
union all
|
|
select * from alltypestiny where year=2009 and month=4)
|
|
union all
|
|
(select * from alltypestiny where year=2009 and month=4
|
|
union all
|
|
(select * from alltypestiny where year=2009 and month=5)
|
|
order by 3 limit 3)
|
|
---- TYPES
|
|
int, int, int, boolean, tinyint, smallint, int, bigint, float, double, string, string, timestamp
|
|
---- RESULTS
|
|
2009,1,0,true,0,0,0,0,0,0,'01/01/09','0',2009-01-01 00:00:00
|
|
2009,1,1,false,1,1,1,10,1.100000023841858,10.1,'01/01/09','1',2009-01-01 00:01:00
|
|
2009,2,2,true,0,0,0,0,0,0,'02/01/09','0',2009-02-01 00:00:00
|
|
2009,2,3,false,1,1,1,10,1.100000023841858,10.1,'02/01/09','1',2009-02-01 00:01:00
|
|
2009,3,4,true,0,0,0,0,0,0,'03/01/09','0',2009-03-01 00:00:00
|
|
2009,3,4,true,0,0,0,0,0,0,'03/01/09','0',2009-03-01 00:00:00
|
|
2009,3,5,false,1,1,1,10,1.100000023841858,10.1,'03/01/09','1',2009-03-01 00:01:00
|
|
2009,4,6,true,0,0,0,0,0,0,'04/01/09','0',2009-04-01 00:00:00
|
|
2009,4,6,true,0,0,0,0,0,0,'04/01/09','0',2009-04-01 00:00:00
|
|
2009,4,7,false,1,1,1,10,1.100000023841858,10.1,'04/01/09','1',2009-04-01 00:01:00
|
|
2009,4,7,false,1,1,1,10,1.100000023841858,10.1,'04/01/09','1',2009-04-01 00:01:00
|
|
====
|
|
// UNION ALL in subquery
|
|
select x.* from
|
|
(select * from alltypestiny where year=2009 and month=1
|
|
union all
|
|
select * from alltypestiny where year=2009 and month=1) x
|
|
union all
|
|
(select * from alltypestiny where year=2009 and month=2)
|
|
order by 3 limit 5
|
|
---- TYPES
|
|
int, int, int, boolean, tinyint, smallint, int, bigint, float, double, string, string, timestamp
|
|
---- RESULTS
|
|
2009,1,0,true,0,0,0,0,0,0,'01/01/09','0',2009-01-01 00:00:00
|
|
2009,1,0,true,0,0,0,0,0,0,'01/01/09','0',2009-01-01 00:00:00
|
|
2009,1,1,false,1,1,1,10,1.100000023841858,10.1,'01/01/09','1',2009-01-01 00:01:00
|
|
2009,1,1,false,1,1,1,10,1.100000023841858,10.1,'01/01/09','1',2009-01-01 00:01:00
|
|
2009,2,2,true,0,0,0,0,0,0,'02/01/09','0',2009-02-01 00:00:00
|
|
====
|
|
// UNION DISTINCT in subquery
|
|
select x.* from
|
|
(select * from alltypestiny where year=2009 and month=1
|
|
union distinct
|
|
select * from alltypestiny where year=2009 and month=1) x
|
|
union distinct
|
|
(select * from alltypestiny where year=2009 and month=2)
|
|
order by 3 limit 3
|
|
---- TYPES
|
|
int, int, int, boolean, tinyint, smallint, int, bigint, float, double, string, string, timestamp
|
|
---- RESULTS
|
|
2009,1,0,true,0,0,0,0,0,0,'01/01/09','0',2009-01-01 00:00:00
|
|
2009,1,1,false,1,1,1,10,1.100000023841858,10.1,'01/01/09','1',2009-01-01 00:01:00
|
|
2009,2,2,true,0,0,0,0,0,0,'02/01/09','0',2009-02-01 00:00:00
|
|
====
|
|
// UNION ALL in subquery with a WHERE condition in the outer select.
|
|
select x.* from
|
|
(select * from alltypestiny where year=2009 and month=1
|
|
union all
|
|
select * from alltypestiny where year=2009 and month=1) x
|
|
where x.int_col < 5 and x.bool_col = false
|
|
---- TYPES
|
|
int, int, int, boolean, tinyint, smallint, int, bigint, float, double, string, string, timestamp
|
|
---- RESULTS
|
|
2009,1,1,false,1,1,1,10,1.100000023841858,10.1,'01/01/09','1',2009-01-01 00:01:00
|
|
2009,1,1,false,1,1,1,10,1.100000023841858,10.1,'01/01/09','1',2009-01-01 00:01:00
|
|
====
|
|
// UNION DISTINCT in subquery with a WHERE condition in the outer select.
|
|
select x.* from
|
|
(select * from alltypestiny where year=2009 and month=1
|
|
union distinct
|
|
select * from alltypestiny where year=2009 and month=1) x
|
|
where x.int_col < 5 and x.bool_col = false
|
|
---- TYPES
|
|
int, int, int, boolean, tinyint, smallint, int, bigint, float, double, string, string, timestamp
|
|
---- RESULTS
|
|
2009,1,1,false,1,1,1,10,1.100000023841858,10.1,'01/01/09','1',2009-01-01 00:01:00
|
|
====
|
|
// Test UNION ALL with only constant selects (no table descriptors).
|
|
select 1, 1.0, 'hello'
|
|
union all
|
|
select 2, 2.0, 'world'
|
|
union all
|
|
select 3, 3.0, 'foo'
|
|
union all
|
|
select 3, 3.0, 'bar'
|
|
---- TYPES
|
|
tinyint, float, string
|
|
---- RESULTS
|
|
1,1,'hello'
|
|
2,2,'world'
|
|
3,3,'bar'
|
|
3,3,'foo'
|
|
====
|
|
// Test UNION ALL with mixed constant and non-constant selects. Also tests implicit casts.
|
|
select 10, 10.0, "abcde"
|
|
union all
|
|
select int_col, float_col, string_col
|
|
from alltypestiny where year=2009 and month=1
|
|
union all
|
|
select 20, 20.0, "fghijkl"
|
|
union all
|
|
select tinyint_col, double_col, string_col
|
|
from alltypestiny where year=2009 and month=1
|
|
---- TYPES
|
|
int, double, string
|
|
---- RESULTS
|
|
0,0,'0'
|
|
0,0,'0'
|
|
1,1.100000023841858,'1'
|
|
1,10.1,'1'
|
|
10,10,'abcde'
|
|
20,20,'fghijkl'
|
|
====
|
|
// Test UNION ALL on large tables with a few constant selects to excercise backend logic.
|
|
select count(*) from (
|
|
select * from alltypes
|
|
union all
|
|
select 2009,1,0,true,0,0,0,0,cast(0 as float),0,'01/01/09','0',cast('2009-01-01 00:00:00' as timestamp)
|
|
union all
|
|
select * from alltypes
|
|
union all
|
|
select 2009,1,1,false,1,1,1,10,cast(1.1 as float),10.1,'01/01/09','1',cast('2009-01-01 00:01:00' as timestamp)
|
|
union all
|
|
select 2009,1,2,true,2,2,2,20,cast(2.2 as float),20.2,'01/01/09','2',cast('2009-01-01 00:02:00.10' as timestamp)
|
|
) x
|
|
---- TYPES
|
|
bigint
|
|
---- RESULTS
|
|
14603
|
|
====
|
|
// Test UNION DISTINCT on large tables with a few constant selects to excercise backend logic.
|
|
select count(*) from (
|
|
select * from alltypes
|
|
union distinct
|
|
select 2009,1,0,true,0,0,0,0,cast(0 as float),0,'01/01/09','0',cast('2009-01-01 00:00:00' as timestamp)
|
|
union distinct
|
|
select * from alltypes
|
|
union distinct
|
|
select 2009,1,1,false,1,1,1,10,cast(1.1 as float),10.1,'01/01/09','1',cast('2009-01-01 00:01:00' as timestamp)
|
|
union distinct
|
|
select 2009,1,2,true,2,2,2,20,cast(2.2 as float),20.2,'01/01/09','2',cast('2009-01-01 00:02:00.10' as timestamp)
|
|
) x
|
|
---- TYPES
|
|
bigint
|
|
---- RESULTS
|
|
7300
|
|
====
|