mirror of
https://github.com/apache/impala.git
synced 2026-01-07 09:02:19 -05:00
This patch simplifies the complex slot materialization logic for unions by making the materialization independent of conjuncts assigned to MergeNodes. When 'pushing down' predicates into union operands, we drop union operands with constant predicates evaluating to false. Constant predicates that evaluate to true are simply ignored. Change-Id: I0e7ccfb206bed29db2b5d667e2bb61310980e80a Reviewed-on: http://gerrit.ent.cloudera.com:8080/2327 Reviewed-by: Alex Behm <alex.behm@cloudera.com> Tested-by: jenkins
2814 lines
90 KiB
Plaintext
2814 lines
90 KiB
Plaintext
# binding predicates of b.month equiv class gets propagated into union
|
|
select * from
|
|
(select year, month from functional.alltypes
|
|
union all
|
|
select year, month from functional.alltypes) a
|
|
inner join
|
|
functional.alltypessmall b
|
|
on (a.month = b.month)
|
|
where b.month = 1
|
|
---- PLAN
|
|
04:HASH JOIN [INNER JOIN]
|
|
| hash predicates: month = b.month
|
|
|
|
|
|--03:SCAN HDFS [functional.alltypessmall b]
|
|
| partitions=1/4 size=1.57KB compact
|
|
|
|
|
00:MERGE
|
|
|
|
|
|--02:SCAN HDFS [functional.alltypes]
|
|
| partitions=2/24 size=40.32KB
|
|
|
|
|
01:SCAN HDFS [functional.alltypes]
|
|
partitions=2/24 size=40.32KB
|
|
---- DISTRIBUTEDPLAN
|
|
04:HASH JOIN [INNER JOIN, BROADCAST]
|
|
| hash predicates: month = b.month
|
|
|
|
|
|--08:EXCHANGE [PARTITION=UNPARTITIONED]
|
|
| |
|
|
| 03:SCAN HDFS [functional.alltypessmall b]
|
|
| partitions=1/4 size=1.57KB
|
|
|
|
|
05:EXCHANGE [PARTITION=UNPARTITIONED]
|
|
|
|
|
|--07:MERGE
|
|
| |
|
|
| 02:SCAN HDFS [functional.alltypes]
|
|
| partitions=2/24 size=40.32KB
|
|
|
|
|
06:MERGE
|
|
|
|
|
01:SCAN HDFS [functional.alltypes]
|
|
partitions=2/24 size=40.32KB
|
|
====
|
|
// Only UNION ALL, no nested unions
|
|
select * from functional.alltypestiny where year=2009 and month=1
|
|
union all
|
|
select * from functional.alltypestiny where year=2009 and month=1
|
|
union all
|
|
select * from functional.alltypestiny where year=2009 and month=2
|
|
---- PLAN
|
|
00:MERGE
|
|
|
|
|
|--03:SCAN HDFS [functional.alltypestiny]
|
|
| partitions=1/4 size=115B
|
|
|
|
|
|--02:SCAN HDFS [functional.alltypestiny]
|
|
| partitions=1/4 size=115B
|
|
|
|
|
01:SCAN HDFS [functional.alltypestiny]
|
|
partitions=1/4 size=115B
|
|
---- SCANRANGELOCATIONS
|
|
NODE 1:
|
|
HDFS SPLIT hdfs://localhost:20500/test-warehouse/alltypestiny/year=2009/month=1/090101.txt 0:115
|
|
NODE 2:
|
|
HDFS SPLIT hdfs://localhost:20500/test-warehouse/alltypestiny/year=2009/month=1/090101.txt 0:115
|
|
NODE 3:
|
|
HDFS SPLIT hdfs://localhost:20500/test-warehouse/alltypestiny/year=2009/month=2/090201.txt 0:115
|
|
---- DISTRIBUTEDPLAN
|
|
04:EXCHANGE [PARTITION=UNPARTITIONED]
|
|
|
|
|
|--07:MERGE
|
|
| |
|
|
| 03:SCAN HDFS [functional.alltypestiny]
|
|
| partitions=1/4 size=115B
|
|
|
|
|
|--06:MERGE
|
|
| |
|
|
| 02:SCAN HDFS [functional.alltypestiny]
|
|
| partitions=1/4 size=115B
|
|
|
|
|
05:MERGE
|
|
|
|
|
01:SCAN HDFS [functional.alltypestiny]
|
|
partitions=1/4 size=115B
|
|
====
|
|
// Only UNION ALL with limit inside operands. One of the operands also has an order by.
|
|
select * from functional.alltypestiny where year=2009 and month=1 limit 1
|
|
union all
|
|
select * from functional.alltypestiny where year=2009 and month=1 order by int_col limit 1
|
|
union all
|
|
select * from functional.alltypestiny where year=2009 and month=2 limit 1
|
|
---- PLAN
|
|
00:MERGE
|
|
|
|
|
|--04:SCAN HDFS [functional.alltypestiny]
|
|
| partitions=1/4 size=115B
|
|
| limit: 1
|
|
|
|
|
|--03:TOP-N [LIMIT=1]
|
|
| | order by: int_col ASC
|
|
| |
|
|
| 02:SCAN HDFS [functional.alltypestiny]
|
|
| partitions=1/4 size=115B
|
|
|
|
|
01:SCAN HDFS [functional.alltypestiny]
|
|
partitions=1/4 size=115B
|
|
limit: 1
|
|
---- SCANRANGELOCATIONS
|
|
NODE 1:
|
|
HDFS SPLIT hdfs://localhost:20500/test-warehouse/alltypestiny/year=2009/month=1/090101.txt 0:115
|
|
NODE 2:
|
|
HDFS SPLIT hdfs://localhost:20500/test-warehouse/alltypestiny/year=2009/month=1/090101.txt 0:115
|
|
NODE 4:
|
|
HDFS SPLIT hdfs://localhost:20500/test-warehouse/alltypestiny/year=2009/month=2/090201.txt 0:115
|
|
---- DISTRIBUTEDPLAN
|
|
09:EXCHANGE [PARTITION=UNPARTITIONED]
|
|
|
|
|
|--12:MERGE
|
|
| |
|
|
| 08:EXCHANGE [PARTITION=UNPARTITIONED]
|
|
| | limit: 1
|
|
| |
|
|
| 04:SCAN HDFS [functional.alltypestiny]
|
|
| partitions=1/4 size=115B
|
|
| limit: 1
|
|
|
|
|
|--11:MERGE
|
|
| |
|
|
| 07:TOP-N [LIMIT=1]
|
|
| | order by: int_col ASC
|
|
| |
|
|
| 06:EXCHANGE [PARTITION=UNPARTITIONED]
|
|
| |
|
|
| 03:TOP-N [LIMIT=1]
|
|
| | order by: int_col ASC
|
|
| |
|
|
| 02:SCAN HDFS [functional.alltypestiny]
|
|
| partitions=1/4 size=115B
|
|
|
|
|
10:MERGE
|
|
|
|
|
05:EXCHANGE [PARTITION=UNPARTITIONED]
|
|
| limit: 1
|
|
|
|
|
01:SCAN HDFS [functional.alltypestiny]
|
|
partitions=1/4 size=115B
|
|
limit: 1
|
|
====
|
|
// Only UNION DISTINCT, no nested unions
|
|
select * from functional.alltypestiny where year=2009 and month=1
|
|
union distinct
|
|
select * from functional.alltypestiny where year=2009 and month=1
|
|
union distinct
|
|
select * from functional.alltypestiny where year=2009 and month=2
|
|
---- PLAN
|
|
04:AGGREGATE [FINALIZE]
|
|
| group by: id, bool_col, tinyint_col, smallint_col, int_col, bigint_col, float_col, double_col, date_string_col, string_col, timestamp_col, year, month
|
|
|
|
|
00:MERGE
|
|
|
|
|
|--03:SCAN HDFS [functional.alltypestiny]
|
|
| partitions=1/4 size=115B
|
|
|
|
|
|--02:SCAN HDFS [functional.alltypestiny]
|
|
| partitions=1/4 size=115B
|
|
|
|
|
01:SCAN HDFS [functional.alltypestiny]
|
|
partitions=1/4 size=115B
|
|
---- SCANRANGELOCATIONS
|
|
NODE 1:
|
|
HDFS SPLIT hdfs://localhost:20500/test-warehouse/alltypestiny/year=2009/month=1/090101.txt 0:115
|
|
NODE 2:
|
|
HDFS SPLIT hdfs://localhost:20500/test-warehouse/alltypestiny/year=2009/month=1/090101.txt 0:115
|
|
NODE 3:
|
|
HDFS SPLIT hdfs://localhost:20500/test-warehouse/alltypestiny/year=2009/month=2/090201.txt 0:115
|
|
---- DISTRIBUTEDPLAN
|
|
13:EXCHANGE [PARTITION=UNPARTITIONED]
|
|
|
|
|
12:AGGREGATE [MERGE FINALIZE]
|
|
| group by: id, bool_col, tinyint_col, smallint_col, int_col, bigint_col, float_col, double_col, date_string_col, string_col, timestamp_col, year, month
|
|
|
|
|
11:EXCHANGE [PARTITION=HASH(id,bool_col,tinyint_col,smallint_col,int_col,bigint_col,float_col,double_col,date_string_col,string_col,timestamp_col,year,month)]
|
|
|
|
|
|--10:AGGREGATE
|
|
| | group by: id, bool_col, tinyint_col, smallint_col, int_col, bigint_col, float_col, double_col, date_string_col, string_col, timestamp_col, year, month
|
|
| |
|
|
| 08:MERGE
|
|
| |
|
|
| 03:SCAN HDFS [functional.alltypestiny]
|
|
| partitions=1/4 size=115B
|
|
|
|
|
|--09:AGGREGATE
|
|
| | group by: id, bool_col, tinyint_col, smallint_col, int_col, bigint_col, float_col, double_col, date_string_col, string_col, timestamp_col, year, month
|
|
| |
|
|
| 07:MERGE
|
|
| |
|
|
| 02:SCAN HDFS [functional.alltypestiny]
|
|
| partitions=1/4 size=115B
|
|
|
|
|
04:AGGREGATE
|
|
| group by: id, bool_col, tinyint_col, smallint_col, int_col, bigint_col, float_col, double_col, date_string_col, string_col, timestamp_col, year, month
|
|
|
|
|
06:MERGE
|
|
|
|
|
01:SCAN HDFS [functional.alltypestiny]
|
|
partitions=1/4 size=115B
|
|
====
|
|
// Only UNION ALL, mixed selects with and without from clauses, no nested unions
|
|
select * from functional.alltypestiny where year=2009 and month=1
|
|
union all
|
|
select 0,true,0,0,0,0,0,0,'01/01/09','0',cast('2009-01-01 00:00:00' as timestamp),2009,1
|
|
union all
|
|
select * from functional.alltypestiny where year=2009 and month=1
|
|
union all
|
|
select 1,false,1,1,1,10,1.1,10.1,'01/01/09','1',cast('2009-01-01 00:01:00' as timestamp),2009,1
|
|
---- PLAN
|
|
00:MERGE
|
|
| constant-selects=2
|
|
|
|
|
|--02:SCAN HDFS [functional.alltypestiny]
|
|
| partitions=1/4 size=115B
|
|
|
|
|
01:SCAN HDFS [functional.alltypestiny]
|
|
partitions=1/4 size=115B
|
|
---- SCANRANGELOCATIONS
|
|
NODE 1:
|
|
HDFS SPLIT hdfs://localhost:20500/test-warehouse/alltypestiny/year=2009/month=1/090101.txt 0:115
|
|
NODE 2:
|
|
HDFS SPLIT hdfs://localhost:20500/test-warehouse/alltypestiny/year=2009/month=1/090101.txt 0:115
|
|
---- DISTRIBUTEDPLAN
|
|
03:EXCHANGE [PARTITION=UNPARTITIONED]
|
|
|
|
|
|--06:MERGE
|
|
| constant-selects=2
|
|
|
|
|
|--05:MERGE
|
|
| |
|
|
| 02:SCAN HDFS [functional.alltypestiny]
|
|
| partitions=1/4 size=115B
|
|
|
|
|
04:MERGE
|
|
|
|
|
01:SCAN HDFS [functional.alltypestiny]
|
|
partitions=1/4 size=115B
|
|
====
|
|
// Only UNION DISTINCT, mixed selects with and without from clauses, no nested unions
|
|
select * from functional.alltypestiny where year=2009 and month=1
|
|
union distinct
|
|
select 0,true,0,0,0,0,0,0,'01/01/09','0',cast('2009-01-01 00:00:00' as timestamp),2009,1
|
|
union distinct
|
|
select * from functional.alltypestiny where year=2009 and month=1
|
|
union distinct
|
|
select 1,false,1,1,1,10,1.1,10.1,'01/01/09','1',cast('2009-01-01 00:01:00' as timestamp),2009,1
|
|
---- PLAN
|
|
03:AGGREGATE [FINALIZE]
|
|
| group by: id, bool_col, tinyint_col, smallint_col, int_col, bigint_col, float_col, double_col, date_string_col, string_col, timestamp_col, year, month
|
|
|
|
|
00:MERGE
|
|
| constant-selects=2
|
|
|
|
|
|--02:SCAN HDFS [functional.alltypestiny]
|
|
| partitions=1/4 size=115B
|
|
|
|
|
01:SCAN HDFS [functional.alltypestiny]
|
|
partitions=1/4 size=115B
|
|
---- SCANRANGELOCATIONS
|
|
NODE 1:
|
|
HDFS SPLIT hdfs://localhost:20500/test-warehouse/alltypestiny/year=2009/month=1/090101.txt 0:115
|
|
NODE 2:
|
|
HDFS SPLIT hdfs://localhost:20500/test-warehouse/alltypestiny/year=2009/month=1/090101.txt 0:115
|
|
---- DISTRIBUTEDPLAN
|
|
12:EXCHANGE [PARTITION=UNPARTITIONED]
|
|
|
|
|
11:AGGREGATE [MERGE FINALIZE]
|
|
| group by: id, bool_col, tinyint_col, smallint_col, int_col, bigint_col, float_col, double_col, date_string_col, string_col, timestamp_col, year, month
|
|
|
|
|
10:EXCHANGE [PARTITION=HASH(id,bool_col,tinyint_col,smallint_col,int_col,bigint_col,float_col,double_col,date_string_col,string_col,timestamp_col,year,month)]
|
|
|
|
|
|--09:AGGREGATE
|
|
| | group by: id, bool_col, tinyint_col, smallint_col, int_col, bigint_col, float_col, double_col, date_string_col, string_col, timestamp_col, year, month
|
|
| |
|
|
| 07:MERGE
|
|
| constant-selects=2
|
|
|
|
|
|--08:AGGREGATE
|
|
| | group by: id, bool_col, tinyint_col, smallint_col, int_col, bigint_col, float_col, double_col, date_string_col, string_col, timestamp_col, year, month
|
|
| |
|
|
| 06:MERGE
|
|
| |
|
|
| 02:SCAN HDFS [functional.alltypestiny]
|
|
| partitions=1/4 size=115B
|
|
|
|
|
03:AGGREGATE
|
|
| group by: id, bool_col, tinyint_col, smallint_col, int_col, bigint_col, float_col, double_col, date_string_col, string_col, timestamp_col, year, month
|
|
|
|
|
05:MERGE
|
|
|
|
|
01:SCAN HDFS [functional.alltypestiny]
|
|
partitions=1/4 size=115B
|
|
====
|
|
// Mixed UNION ALL/DISTINCT but effectively only UNION DISTINCT, no nested unions,
|
|
// with order by and limit
|
|
select * from functional.alltypestiny where year=2009 and month=1
|
|
union all
|
|
select * from functional.alltypestiny where year=2009 and month=1
|
|
union all
|
|
select * from functional.alltypestiny where year=2009 and month=2
|
|
union distinct
|
|
(select * from functional.alltypestiny where year=2009 and month=2)
|
|
order by 3 limit 3
|
|
---- PLAN
|
|
06:TOP-N [LIMIT=3]
|
|
| order by: tinyint_col ASC
|
|
|
|
|
05:AGGREGATE [FINALIZE]
|
|
| group by: id, bool_col, tinyint_col, smallint_col, int_col, bigint_col, float_col, double_col, date_string_col, string_col, timestamp_col, year, month
|
|
|
|
|
00:MERGE
|
|
|
|
|
|--04:SCAN HDFS [functional.alltypestiny]
|
|
| partitions=1/4 size=115B
|
|
|
|
|
|--03:SCAN HDFS [functional.alltypestiny]
|
|
| partitions=1/4 size=115B
|
|
|
|
|
|--02:SCAN HDFS [functional.alltypestiny]
|
|
| partitions=1/4 size=115B
|
|
|
|
|
01:SCAN HDFS [functional.alltypestiny]
|
|
partitions=1/4 size=115B
|
|
---- SCANRANGELOCATIONS
|
|
NODE 1:
|
|
HDFS SPLIT hdfs://localhost:20500/test-warehouse/alltypestiny/year=2009/month=1/090101.txt 0:115
|
|
NODE 2:
|
|
HDFS SPLIT hdfs://localhost:20500/test-warehouse/alltypestiny/year=2009/month=1/090101.txt 0:115
|
|
NODE 3:
|
|
HDFS SPLIT hdfs://localhost:20500/test-warehouse/alltypestiny/year=2009/month=2/090201.txt 0:115
|
|
NODE 4:
|
|
HDFS SPLIT hdfs://localhost:20500/test-warehouse/alltypestiny/year=2009/month=2/090201.txt 0:115
|
|
---- DISTRIBUTEDPLAN
|
|
18:TOP-N [LIMIT=3]
|
|
| order by: tinyint_col ASC
|
|
|
|
|
17:EXCHANGE [PARTITION=UNPARTITIONED]
|
|
|
|
|
06:TOP-N [LIMIT=3]
|
|
| order by: tinyint_col ASC
|
|
|
|
|
16:AGGREGATE [MERGE FINALIZE]
|
|
| group by: id, bool_col, tinyint_col, smallint_col, int_col, bigint_col, float_col, double_col, date_string_col, string_col, timestamp_col, year, month
|
|
|
|
|
15:EXCHANGE [PARTITION=HASH(id,bool_col,tinyint_col,smallint_col,int_col,bigint_col,float_col,double_col,date_string_col,string_col,timestamp_col,year,month)]
|
|
|
|
|
|--14:AGGREGATE
|
|
| | group by: id, bool_col, tinyint_col, smallint_col, int_col, bigint_col, float_col, double_col, date_string_col, string_col, timestamp_col, year, month
|
|
| |
|
|
| 11:MERGE
|
|
| |
|
|
| 04:SCAN HDFS [functional.alltypestiny]
|
|
| partitions=1/4 size=115B
|
|
|
|
|
|--13:AGGREGATE
|
|
| | group by: id, bool_col, tinyint_col, smallint_col, int_col, bigint_col, float_col, double_col, date_string_col, string_col, timestamp_col, year, month
|
|
| |
|
|
| 10:MERGE
|
|
| |
|
|
| 03:SCAN HDFS [functional.alltypestiny]
|
|
| partitions=1/4 size=115B
|
|
|
|
|
|--12:AGGREGATE
|
|
| | group by: id, bool_col, tinyint_col, smallint_col, int_col, bigint_col, float_col, double_col, date_string_col, string_col, timestamp_col, year, month
|
|
| |
|
|
| 09:MERGE
|
|
| |
|
|
| 02:SCAN HDFS [functional.alltypestiny]
|
|
| partitions=1/4 size=115B
|
|
|
|
|
05:AGGREGATE
|
|
| group by: id, bool_col, tinyint_col, smallint_col, int_col, bigint_col, float_col, double_col, date_string_col, string_col, timestamp_col, year, month
|
|
|
|
|
08:MERGE
|
|
|
|
|
01:SCAN HDFS [functional.alltypestiny]
|
|
partitions=1/4 size=115B
|
|
====
|
|
// Mixed UNION ALL/DISTINCT, no nested unions, with order by and limit
|
|
select * from functional.alltypestiny where year=2009 and month=1
|
|
union distinct
|
|
select * from functional.alltypestiny where year=2009 and month=1
|
|
union all
|
|
select * from functional.alltypestiny where year=2009 and month=2
|
|
union all
|
|
(select * from functional.alltypestiny where year=2009 and month=2)
|
|
order by 3,4 limit 3
|
|
---- PLAN
|
|
07:TOP-N [LIMIT=3]
|
|
| order by: tinyint_col ASC, smallint_col ASC
|
|
|
|
|
04:MERGE
|
|
|
|
|
|--03:AGGREGATE [FINALIZE]
|
|
| | group by: id, bool_col, tinyint_col, smallint_col, int_col, bigint_col, float_col, double_col, date_string_col, string_col, timestamp_col, year, month
|
|
| |
|
|
| 00:MERGE
|
|
| |
|
|
| |--02:SCAN HDFS [functional.alltypestiny]
|
|
| | partitions=1/4 size=115B
|
|
| |
|
|
| 01:SCAN HDFS [functional.alltypestiny]
|
|
| partitions=1/4 size=115B
|
|
|
|
|
|--06:SCAN HDFS [functional.alltypestiny]
|
|
| partitions=1/4 size=115B
|
|
|
|
|
05:SCAN HDFS [functional.alltypestiny]
|
|
partitions=1/4 size=115B
|
|
---- SCANRANGELOCATIONS
|
|
NODE 1:
|
|
HDFS SPLIT hdfs://localhost:20500/test-warehouse/alltypestiny/year=2009/month=1/090101.txt 0:115
|
|
NODE 2:
|
|
HDFS SPLIT hdfs://localhost:20500/test-warehouse/alltypestiny/year=2009/month=1/090101.txt 0:115
|
|
NODE 5:
|
|
HDFS SPLIT hdfs://localhost:20500/test-warehouse/alltypestiny/year=2009/month=2/090201.txt 0:115
|
|
NODE 6:
|
|
HDFS SPLIT hdfs://localhost:20500/test-warehouse/alltypestiny/year=2009/month=2/090201.txt 0:115
|
|
---- DISTRIBUTEDPLAN
|
|
21:TOP-N [LIMIT=3]
|
|
| order by: tinyint_col ASC, smallint_col ASC
|
|
|
|
|
20:EXCHANGE [PARTITION=UNPARTITIONED]
|
|
|
|
|
|--19:TOP-N [LIMIT=3]
|
|
| | order by: tinyint_col ASC, smallint_col ASC
|
|
| |
|
|
| 17:MERGE
|
|
| |
|
|
| 13:AGGREGATE [MERGE FINALIZE]
|
|
| | group by: id, bool_col, tinyint_col, smallint_col, int_col, bigint_col, float_col, double_col, date_string_col, string_col, timestamp_col, year, month
|
|
| |
|
|
| 12:EXCHANGE [PARTITION=HASH(id,bool_col,tinyint_col,smallint_col,int_col,bigint_col,float_col,double_col,date_string_col,string_col,timestamp_col,year,month)]
|
|
| |
|
|
| |--11:AGGREGATE
|
|
| | | group by: id, bool_col, tinyint_col, smallint_col, int_col, bigint_col, float_col, double_col, date_string_col, string_col, timestamp_col, year, month
|
|
| | |
|
|
| | 10:MERGE
|
|
| | |
|
|
| | 02:SCAN HDFS [functional.alltypestiny]
|
|
| | partitions=1/4 size=115B
|
|
| |
|
|
| 03:AGGREGATE
|
|
| | group by: id, bool_col, tinyint_col, smallint_col, int_col, bigint_col, float_col, double_col, date_string_col, string_col, timestamp_col, year, month
|
|
| |
|
|
| 09:MERGE
|
|
| |
|
|
| 01:SCAN HDFS [functional.alltypestiny]
|
|
| partitions=1/4 size=115B
|
|
|
|
|
|--18:TOP-N [LIMIT=3]
|
|
| | order by: tinyint_col ASC, smallint_col ASC
|
|
| |
|
|
| 16:MERGE
|
|
| |
|
|
| 06:SCAN HDFS [functional.alltypestiny]
|
|
| partitions=1/4 size=115B
|
|
|
|
|
07:TOP-N [LIMIT=3]
|
|
| order by: tinyint_col ASC, smallint_col ASC
|
|
|
|
|
15:MERGE
|
|
|
|
|
05:SCAN HDFS [functional.alltypestiny]
|
|
partitions=1/4 size=115B
|
|
====
|
|
// Mixed UNION ALL/DISTINCT, no nested unions, with order by and limit
|
|
select * from functional.alltypestiny where year=2009 and month=1
|
|
union all
|
|
select * from functional.alltypestiny where year=2009 and month=1
|
|
union distinct
|
|
select * from functional.alltypestiny where year=2009 and month=2
|
|
union all
|
|
(select * from functional.alltypestiny where year=2009 and month=2)
|
|
order by 3,4 limit 4
|
|
---- PLAN
|
|
07:TOP-N [LIMIT=4]
|
|
| order by: tinyint_col ASC, smallint_col ASC
|
|
|
|
|
05:MERGE
|
|
|
|
|
|--04:AGGREGATE [FINALIZE]
|
|
| | group by: id, bool_col, tinyint_col, smallint_col, int_col, bigint_col, float_col, double_col, date_string_col, string_col, timestamp_col, year, month
|
|
| |
|
|
| 00:MERGE
|
|
| |
|
|
| |--03:SCAN HDFS [functional.alltypestiny]
|
|
| | partitions=1/4 size=115B
|
|
| |
|
|
| |--02:SCAN HDFS [functional.alltypestiny]
|
|
| | partitions=1/4 size=115B
|
|
| |
|
|
| 01:SCAN HDFS [functional.alltypestiny]
|
|
| partitions=1/4 size=115B
|
|
|
|
|
06:SCAN HDFS [functional.alltypestiny]
|
|
partitions=1/4 size=115B
|
|
---- SCANRANGELOCATIONS
|
|
NODE 1:
|
|
HDFS SPLIT hdfs://localhost:20500/test-warehouse/alltypestiny/year=2009/month=1/090101.txt 0:115
|
|
NODE 2:
|
|
HDFS SPLIT hdfs://localhost:20500/test-warehouse/alltypestiny/year=2009/month=1/090101.txt 0:115
|
|
NODE 3:
|
|
HDFS SPLIT hdfs://localhost:20500/test-warehouse/alltypestiny/year=2009/month=2/090201.txt 0:115
|
|
NODE 6:
|
|
HDFS SPLIT hdfs://localhost:20500/test-warehouse/alltypestiny/year=2009/month=2/090201.txt 0:115
|
|
---- DISTRIBUTEDPLAN
|
|
21:TOP-N [LIMIT=4]
|
|
| order by: tinyint_col ASC, smallint_col ASC
|
|
|
|
|
20:EXCHANGE [PARTITION=UNPARTITIONED]
|
|
|
|
|
|--19:TOP-N [LIMIT=4]
|
|
| | order by: tinyint_col ASC, smallint_col ASC
|
|
| |
|
|
| 18:MERGE
|
|
| |
|
|
| 15:AGGREGATE [MERGE FINALIZE]
|
|
| | group by: id, bool_col, tinyint_col, smallint_col, int_col, bigint_col, float_col, double_col, date_string_col, string_col, timestamp_col, year, month
|
|
| |
|
|
| 14:EXCHANGE [PARTITION=HASH(id,bool_col,tinyint_col,smallint_col,int_col,bigint_col,float_col,double_col,date_string_col,string_col,timestamp_col,year,month)]
|
|
| |
|
|
| |--13:AGGREGATE
|
|
| | | group by: id, bool_col, tinyint_col, smallint_col, int_col, bigint_col, float_col, double_col, date_string_col, string_col, timestamp_col, year, month
|
|
| | |
|
|
| | 11:MERGE
|
|
| | |
|
|
| | 03:SCAN HDFS [functional.alltypestiny]
|
|
| | partitions=1/4 size=115B
|
|
| |
|
|
| |--12:AGGREGATE
|
|
| | | group by: id, bool_col, tinyint_col, smallint_col, int_col, bigint_col, float_col, double_col, date_string_col, string_col, timestamp_col, year, month
|
|
| | |
|
|
| | 10:MERGE
|
|
| | |
|
|
| | 02:SCAN HDFS [functional.alltypestiny]
|
|
| | partitions=1/4 size=115B
|
|
| |
|
|
| 04:AGGREGATE
|
|
| | group by: id, bool_col, tinyint_col, smallint_col, int_col, bigint_col, float_col, double_col, date_string_col, string_col, timestamp_col, year, month
|
|
| |
|
|
| 09:MERGE
|
|
| |
|
|
| 01:SCAN HDFS [functional.alltypestiny]
|
|
| partitions=1/4 size=115B
|
|
|
|
|
07:TOP-N [LIMIT=4]
|
|
| order by: tinyint_col ASC, smallint_col ASC
|
|
|
|
|
17:MERGE
|
|
|
|
|
06:SCAN HDFS [functional.alltypestiny]
|
|
partitions=1/4 size=115B
|
|
====
|
|
// Union unnesting: Only UNION ALL, first operand is nested
|
|
(select * from functional.alltypestiny where year=2009 and month=1
|
|
union all
|
|
select * from functional.alltypestiny where year=2009 and month=2)
|
|
union all
|
|
select * from functional.alltypestiny where year=2009 and month=1
|
|
---- PLAN
|
|
00:MERGE
|
|
|
|
|
|--03:SCAN HDFS [functional.alltypestiny]
|
|
| partitions=1/4 size=115B
|
|
|
|
|
|--02:SCAN HDFS [functional.alltypestiny]
|
|
| partitions=1/4 size=115B
|
|
|
|
|
01:SCAN HDFS [functional.alltypestiny]
|
|
partitions=1/4 size=115B
|
|
---- SCANRANGELOCATIONS
|
|
NODE 1:
|
|
HDFS SPLIT hdfs://localhost:20500/test-warehouse/alltypestiny/year=2009/month=1/090101.txt 0:115
|
|
NODE 2:
|
|
HDFS SPLIT hdfs://localhost:20500/test-warehouse/alltypestiny/year=2009/month=2/090201.txt 0:115
|
|
NODE 3:
|
|
HDFS SPLIT hdfs://localhost:20500/test-warehouse/alltypestiny/year=2009/month=1/090101.txt 0:115
|
|
---- DISTRIBUTEDPLAN
|
|
04:EXCHANGE [PARTITION=UNPARTITIONED]
|
|
|
|
|
|--07:MERGE
|
|
| |
|
|
| 03:SCAN HDFS [functional.alltypestiny]
|
|
| partitions=1/4 size=115B
|
|
|
|
|
|--06:MERGE
|
|
| |
|
|
| 02:SCAN HDFS [functional.alltypestiny]
|
|
| partitions=1/4 size=115B
|
|
|
|
|
05:MERGE
|
|
|
|
|
01:SCAN HDFS [functional.alltypestiny]
|
|
partitions=1/4 size=115B
|
|
====
|
|
// Union unnesting: Only UNION ALL, second operand is nested
|
|
select * from functional.alltypestiny where year=2009 and month=1
|
|
union all
|
|
(select * from functional.alltypestiny where year=2009 and month=1
|
|
union all
|
|
select * from functional.alltypestiny where year=2009 and month=2)
|
|
---- PLAN
|
|
00:MERGE
|
|
|
|
|
|--03:SCAN HDFS [functional.alltypestiny]
|
|
| partitions=1/4 size=115B
|
|
|
|
|
|--02:SCAN HDFS [functional.alltypestiny]
|
|
| partitions=1/4 size=115B
|
|
|
|
|
01:SCAN HDFS [functional.alltypestiny]
|
|
partitions=1/4 size=115B
|
|
---- SCANRANGELOCATIONS
|
|
NODE 1:
|
|
HDFS SPLIT hdfs://localhost:20500/test-warehouse/alltypestiny/year=2009/month=1/090101.txt 0:115
|
|
NODE 2:
|
|
HDFS SPLIT hdfs://localhost:20500/test-warehouse/alltypestiny/year=2009/month=1/090101.txt 0:115
|
|
NODE 3:
|
|
HDFS SPLIT hdfs://localhost:20500/test-warehouse/alltypestiny/year=2009/month=2/090201.txt 0:115
|
|
---- DISTRIBUTEDPLAN
|
|
04:EXCHANGE [PARTITION=UNPARTITIONED]
|
|
|
|
|
|--07:MERGE
|
|
| |
|
|
| 03:SCAN HDFS [functional.alltypestiny]
|
|
| partitions=1/4 size=115B
|
|
|
|
|
|--06:MERGE
|
|
| |
|
|
| 02:SCAN HDFS [functional.alltypestiny]
|
|
| partitions=1/4 size=115B
|
|
|
|
|
05:MERGE
|
|
|
|
|
01:SCAN HDFS [functional.alltypestiny]
|
|
partitions=1/4 size=115B
|
|
====
|
|
// Union unnesting: Only UNION DISTINCT, first operand is nested
|
|
(select * from functional.alltypestiny where year=2009 and month=1
|
|
union distinct
|
|
select * from functional.alltypestiny where year=2009 and month=2)
|
|
union distinct
|
|
select * from functional.alltypestiny where year=2009 and month=1
|
|
---- PLAN
|
|
04:AGGREGATE [FINALIZE]
|
|
| group by: id, bool_col, tinyint_col, smallint_col, int_col, bigint_col, float_col, double_col, date_string_col, string_col, timestamp_col, year, month
|
|
|
|
|
00:MERGE
|
|
|
|
|
|--03:SCAN HDFS [functional.alltypestiny]
|
|
| partitions=1/4 size=115B
|
|
|
|
|
|--02:SCAN HDFS [functional.alltypestiny]
|
|
| partitions=1/4 size=115B
|
|
|
|
|
01:SCAN HDFS [functional.alltypestiny]
|
|
partitions=1/4 size=115B
|
|
---- SCANRANGELOCATIONS
|
|
NODE 1:
|
|
HDFS SPLIT hdfs://localhost:20500/test-warehouse/alltypestiny/year=2009/month=1/090101.txt 0:115
|
|
NODE 2:
|
|
HDFS SPLIT hdfs://localhost:20500/test-warehouse/alltypestiny/year=2009/month=2/090201.txt 0:115
|
|
NODE 3:
|
|
HDFS SPLIT hdfs://localhost:20500/test-warehouse/alltypestiny/year=2009/month=1/090101.txt 0:115
|
|
---- DISTRIBUTEDPLAN
|
|
13:EXCHANGE [PARTITION=UNPARTITIONED]
|
|
|
|
|
12:AGGREGATE [MERGE FINALIZE]
|
|
| group by: id, bool_col, tinyint_col, smallint_col, int_col, bigint_col, float_col, double_col, date_string_col, string_col, timestamp_col, year, month
|
|
|
|
|
11:EXCHANGE [PARTITION=HASH(id,bool_col,tinyint_col,smallint_col,int_col,bigint_col,float_col,double_col,date_string_col,string_col,timestamp_col,year,month)]
|
|
|
|
|
|--10:AGGREGATE
|
|
| | group by: id, bool_col, tinyint_col, smallint_col, int_col, bigint_col, float_col, double_col, date_string_col, string_col, timestamp_col, year, month
|
|
| |
|
|
| 08:MERGE
|
|
| |
|
|
| 03:SCAN HDFS [functional.alltypestiny]
|
|
| partitions=1/4 size=115B
|
|
|
|
|
|--09:AGGREGATE
|
|
| | group by: id, bool_col, tinyint_col, smallint_col, int_col, bigint_col, float_col, double_col, date_string_col, string_col, timestamp_col, year, month
|
|
| |
|
|
| 07:MERGE
|
|
| |
|
|
| 02:SCAN HDFS [functional.alltypestiny]
|
|
| partitions=1/4 size=115B
|
|
|
|
|
04:AGGREGATE
|
|
| group by: id, bool_col, tinyint_col, smallint_col, int_col, bigint_col, float_col, double_col, date_string_col, string_col, timestamp_col, year, month
|
|
|
|
|
06:MERGE
|
|
|
|
|
01:SCAN HDFS [functional.alltypestiny]
|
|
partitions=1/4 size=115B
|
|
====
|
|
// Union unnesting: Only UNION DISTINCT, second operand is nested
|
|
select * from functional.alltypestiny where year=2009 and month=1
|
|
union distinct
|
|
(select * from functional.alltypestiny where year=2009 and month=1
|
|
union distinct
|
|
select * from functional.alltypestiny where year=2009 and month=2)
|
|
---- PLAN
|
|
04:AGGREGATE [FINALIZE]
|
|
| group by: id, bool_col, tinyint_col, smallint_col, int_col, bigint_col, float_col, double_col, date_string_col, string_col, timestamp_col, year, month
|
|
|
|
|
00:MERGE
|
|
|
|
|
|--03:SCAN HDFS [functional.alltypestiny]
|
|
| partitions=1/4 size=115B
|
|
|
|
|
|--02:SCAN HDFS [functional.alltypestiny]
|
|
| partitions=1/4 size=115B
|
|
|
|
|
01:SCAN HDFS [functional.alltypestiny]
|
|
partitions=1/4 size=115B
|
|
---- SCANRANGELOCATIONS
|
|
NODE 1:
|
|
HDFS SPLIT hdfs://localhost:20500/test-warehouse/alltypestiny/year=2009/month=1/090101.txt 0:115
|
|
NODE 2:
|
|
HDFS SPLIT hdfs://localhost:20500/test-warehouse/alltypestiny/year=2009/month=1/090101.txt 0:115
|
|
NODE 3:
|
|
HDFS SPLIT hdfs://localhost:20500/test-warehouse/alltypestiny/year=2009/month=2/090201.txt 0:115
|
|
---- DISTRIBUTEDPLAN
|
|
13:EXCHANGE [PARTITION=UNPARTITIONED]
|
|
|
|
|
12:AGGREGATE [MERGE FINALIZE]
|
|
| group by: id, bool_col, tinyint_col, smallint_col, int_col, bigint_col, float_col, double_col, date_string_col, string_col, timestamp_col, year, month
|
|
|
|
|
11:EXCHANGE [PARTITION=HASH(id,bool_col,tinyint_col,smallint_col,int_col,bigint_col,float_col,double_col,date_string_col,string_col,timestamp_col,year,month)]
|
|
|
|
|
|--10:AGGREGATE
|
|
| | group by: id, bool_col, tinyint_col, smallint_col, int_col, bigint_col, float_col, double_col, date_string_col, string_col, timestamp_col, year, month
|
|
| |
|
|
| 08:MERGE
|
|
| |
|
|
| 03:SCAN HDFS [functional.alltypestiny]
|
|
| partitions=1/4 size=115B
|
|
|
|
|
|--09:AGGREGATE
|
|
| | group by: id, bool_col, tinyint_col, smallint_col, int_col, bigint_col, float_col, double_col, date_string_col, string_col, timestamp_col, year, month
|
|
| |
|
|
| 07:MERGE
|
|
| |
|
|
| 02:SCAN HDFS [functional.alltypestiny]
|
|
| partitions=1/4 size=115B
|
|
|
|
|
04:AGGREGATE
|
|
| group by: id, bool_col, tinyint_col, smallint_col, int_col, bigint_col, float_col, double_col, date_string_col, string_col, timestamp_col, year, month
|
|
|
|
|
06:MERGE
|
|
|
|
|
01:SCAN HDFS [functional.alltypestiny]
|
|
partitions=1/4 size=115B
|
|
====
|
|
// Union unnesting: UNION ALL doesn't absorb nested union with DISTINCT,
|
|
// first operand is nested
|
|
(select * from functional.alltypestiny where year=2009 and month=1
|
|
union distinct
|
|
select * from functional.alltypestiny where year=2009 and month=2)
|
|
union all
|
|
select * from functional.alltypestiny where year=2009 and month=1
|
|
---- PLAN
|
|
00:MERGE
|
|
|
|
|
|--05:SCAN HDFS [functional.alltypestiny]
|
|
| partitions=1/4 size=115B
|
|
|
|
|
04:AGGREGATE [FINALIZE]
|
|
| group by: id, bool_col, tinyint_col, smallint_col, int_col, bigint_col, float_col, double_col, date_string_col, string_col, timestamp_col, year, month
|
|
|
|
|
01:MERGE
|
|
|
|
|
|--03:SCAN HDFS [functional.alltypestiny]
|
|
| partitions=1/4 size=115B
|
|
|
|
|
02:SCAN HDFS [functional.alltypestiny]
|
|
partitions=1/4 size=115B
|
|
---- SCANRANGELOCATIONS
|
|
NODE 2:
|
|
HDFS SPLIT hdfs://localhost:20500/test-warehouse/alltypestiny/year=2009/month=1/090101.txt 0:115
|
|
NODE 3:
|
|
HDFS SPLIT hdfs://localhost:20500/test-warehouse/alltypestiny/year=2009/month=2/090201.txt 0:115
|
|
NODE 5:
|
|
HDFS SPLIT hdfs://localhost:20500/test-warehouse/alltypestiny/year=2009/month=1/090101.txt 0:115
|
|
---- DISTRIBUTEDPLAN
|
|
12:EXCHANGE [PARTITION=UNPARTITIONED]
|
|
|
|
|
|--14:MERGE
|
|
| |
|
|
| 05:SCAN HDFS [functional.alltypestiny]
|
|
| partitions=1/4 size=115B
|
|
|
|
|
13:MERGE
|
|
|
|
|
11:AGGREGATE [MERGE FINALIZE]
|
|
| group by: id, bool_col, tinyint_col, smallint_col, int_col, bigint_col, float_col, double_col, date_string_col, string_col, timestamp_col, year, month
|
|
|
|
|
10:EXCHANGE [PARTITION=HASH(id,bool_col,tinyint_col,smallint_col,int_col,bigint_col,float_col,double_col,date_string_col,string_col,timestamp_col,year,month)]
|
|
|
|
|
|--09:AGGREGATE
|
|
| | group by: id, bool_col, tinyint_col, smallint_col, int_col, bigint_col, float_col, double_col, date_string_col, string_col, timestamp_col, year, month
|
|
| |
|
|
| 08:MERGE
|
|
| |
|
|
| 03:SCAN HDFS [functional.alltypestiny]
|
|
| partitions=1/4 size=115B
|
|
|
|
|
04:AGGREGATE
|
|
| group by: id, bool_col, tinyint_col, smallint_col, int_col, bigint_col, float_col, double_col, date_string_col, string_col, timestamp_col, year, month
|
|
|
|
|
07:MERGE
|
|
|
|
|
02:SCAN HDFS [functional.alltypestiny]
|
|
partitions=1/4 size=115B
|
|
====
|
|
// Union unnesting: UNION ALL doesn't absorb nested union with DISTINCT,
|
|
// second operand is nested
|
|
select * from functional.alltypestiny where year=2009 and month=1
|
|
union all
|
|
(select * from functional.alltypestiny where year=2009 and month=1
|
|
union distinct
|
|
select * from functional.alltypestiny where year=2009 and month=2)
|
|
---- PLAN
|
|
00:MERGE
|
|
|
|
|
|--05:AGGREGATE [FINALIZE]
|
|
| | group by: id, bool_col, tinyint_col, smallint_col, int_col, bigint_col, float_col, double_col, date_string_col, string_col, timestamp_col, year, month
|
|
| |
|
|
| 02:MERGE
|
|
| |
|
|
| |--04:SCAN HDFS [functional.alltypestiny]
|
|
| | partitions=1/4 size=115B
|
|
| |
|
|
| 03:SCAN HDFS [functional.alltypestiny]
|
|
| partitions=1/4 size=115B
|
|
|
|
|
01:SCAN HDFS [functional.alltypestiny]
|
|
partitions=1/4 size=115B
|
|
---- SCANRANGELOCATIONS
|
|
NODE 1:
|
|
HDFS SPLIT hdfs://localhost:20500/test-warehouse/alltypestiny/year=2009/month=1/090101.txt 0:115
|
|
NODE 3:
|
|
HDFS SPLIT hdfs://localhost:20500/test-warehouse/alltypestiny/year=2009/month=1/090101.txt 0:115
|
|
NODE 4:
|
|
HDFS SPLIT hdfs://localhost:20500/test-warehouse/alltypestiny/year=2009/month=2/090201.txt 0:115
|
|
---- DISTRIBUTEDPLAN
|
|
12:EXCHANGE [PARTITION=UNPARTITIONED]
|
|
|
|
|
|--14:MERGE
|
|
| |
|
|
| 11:AGGREGATE [MERGE FINALIZE]
|
|
| | group by: id, bool_col, tinyint_col, smallint_col, int_col, bigint_col, float_col, double_col, date_string_col, string_col, timestamp_col, year, month
|
|
| |
|
|
| 10:EXCHANGE [PARTITION=HASH(id,bool_col,tinyint_col,smallint_col,int_col,bigint_col,float_col,double_col,date_string_col,string_col,timestamp_col,year,month)]
|
|
| |
|
|
| |--09:AGGREGATE
|
|
| | | group by: id, bool_col, tinyint_col, smallint_col, int_col, bigint_col, float_col, double_col, date_string_col, string_col, timestamp_col, year, month
|
|
| | |
|
|
| | 08:MERGE
|
|
| | |
|
|
| | 04:SCAN HDFS [functional.alltypestiny]
|
|
| | partitions=1/4 size=115B
|
|
| |
|
|
| 05:AGGREGATE
|
|
| | group by: id, bool_col, tinyint_col, smallint_col, int_col, bigint_col, float_col, double_col, date_string_col, string_col, timestamp_col, year, month
|
|
| |
|
|
| 07:MERGE
|
|
| |
|
|
| 03:SCAN HDFS [functional.alltypestiny]
|
|
| partitions=1/4 size=115B
|
|
|
|
|
13:MERGE
|
|
|
|
|
01:SCAN HDFS [functional.alltypestiny]
|
|
partitions=1/4 size=115B
|
|
====
|
|
// 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 functional.alltypestiny where year=2009 and month=1
|
|
union distinct
|
|
select * from functional.alltypestiny where year=2009 and month=2
|
|
union all
|
|
select * from functional.alltypestiny where year=2009 and month=2)
|
|
union all
|
|
select * from functional.alltypestiny where year=2009 and month=1
|
|
---- PLAN
|
|
00:MERGE
|
|
|
|
|
|--06:SCAN HDFS [functional.alltypestiny]
|
|
| partitions=1/4 size=115B
|
|
|
|
|
|--05:AGGREGATE [FINALIZE]
|
|
| | group by: id, bool_col, tinyint_col, smallint_col, int_col, bigint_col, float_col, double_col, date_string_col, string_col, timestamp_col, year, month
|
|
| |
|
|
| 02:MERGE
|
|
| |
|
|
| |--04:SCAN HDFS [functional.alltypestiny]
|
|
| | partitions=1/4 size=115B
|
|
| |
|
|
| 03:SCAN HDFS [functional.alltypestiny]
|
|
| partitions=1/4 size=115B
|
|
|
|
|
01:SCAN HDFS [functional.alltypestiny]
|
|
partitions=1/4 size=115B
|
|
---- SCANRANGELOCATIONS
|
|
NODE 1:
|
|
HDFS SPLIT hdfs://localhost:20500/test-warehouse/alltypestiny/year=2009/month=2/090201.txt 0:115
|
|
NODE 3:
|
|
HDFS SPLIT hdfs://localhost:20500/test-warehouse/alltypestiny/year=2009/month=1/090101.txt 0:115
|
|
NODE 4:
|
|
HDFS SPLIT hdfs://localhost:20500/test-warehouse/alltypestiny/year=2009/month=2/090201.txt 0:115
|
|
NODE 6:
|
|
HDFS SPLIT hdfs://localhost:20500/test-warehouse/alltypestiny/year=2009/month=1/090101.txt 0:115
|
|
---- DISTRIBUTEDPLAN
|
|
13:EXCHANGE [PARTITION=UNPARTITIONED]
|
|
|
|
|
|--16:MERGE
|
|
| |
|
|
| 06:SCAN HDFS [functional.alltypestiny]
|
|
| partitions=1/4 size=115B
|
|
|
|
|
|--15:MERGE
|
|
| |
|
|
| 12:AGGREGATE [MERGE FINALIZE]
|
|
| | group by: id, bool_col, tinyint_col, smallint_col, int_col, bigint_col, float_col, double_col, date_string_col, string_col, timestamp_col, year, month
|
|
| |
|
|
| 11:EXCHANGE [PARTITION=HASH(id,bool_col,tinyint_col,smallint_col,int_col,bigint_col,float_col,double_col,date_string_col,string_col,timestamp_col,year,month)]
|
|
| |
|
|
| |--10:AGGREGATE
|
|
| | | group by: id, bool_col, tinyint_col, smallint_col, int_col, bigint_col, float_col, double_col, date_string_col, string_col, timestamp_col, year, month
|
|
| | |
|
|
| | 09:MERGE
|
|
| | |
|
|
| | 04:SCAN HDFS [functional.alltypestiny]
|
|
| | partitions=1/4 size=115B
|
|
| |
|
|
| 05:AGGREGATE
|
|
| | group by: id, bool_col, tinyint_col, smallint_col, int_col, bigint_col, float_col, double_col, date_string_col, string_col, timestamp_col, year, month
|
|
| |
|
|
| 08:MERGE
|
|
| |
|
|
| 03:SCAN HDFS [functional.alltypestiny]
|
|
| partitions=1/4 size=115B
|
|
|
|
|
14:MERGE
|
|
|
|
|
01:SCAN HDFS [functional.alltypestiny]
|
|
partitions=1/4 size=115B
|
|
====
|
|
// 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 functional.alltypestiny where year=2009 and month=1
|
|
union all
|
|
(select * from functional.alltypestiny where year=2009 and month=1
|
|
union distinct
|
|
select * from functional.alltypestiny where year=2009 and month=2
|
|
union all
|
|
select * from functional.alltypestiny where year=2009 and month=2)
|
|
---- PLAN
|
|
00:MERGE
|
|
|
|
|
|--06:AGGREGATE [FINALIZE]
|
|
| | group by: id, bool_col, tinyint_col, smallint_col, int_col, bigint_col, float_col, double_col, date_string_col, string_col, timestamp_col, year, month
|
|
| |
|
|
| 03:MERGE
|
|
| |
|
|
| |--05:SCAN HDFS [functional.alltypestiny]
|
|
| | partitions=1/4 size=115B
|
|
| |
|
|
| 04:SCAN HDFS [functional.alltypestiny]
|
|
| partitions=1/4 size=115B
|
|
|
|
|
|--02:SCAN HDFS [functional.alltypestiny]
|
|
| partitions=1/4 size=115B
|
|
|
|
|
01:SCAN HDFS [functional.alltypestiny]
|
|
partitions=1/4 size=115B
|
|
---- SCANRANGELOCATIONS
|
|
NODE 1:
|
|
HDFS SPLIT hdfs://localhost:20500/test-warehouse/alltypestiny/year=2009/month=1/090101.txt 0:115
|
|
NODE 2:
|
|
HDFS SPLIT hdfs://localhost:20500/test-warehouse/alltypestiny/year=2009/month=2/090201.txt 0:115
|
|
NODE 4:
|
|
HDFS SPLIT hdfs://localhost:20500/test-warehouse/alltypestiny/year=2009/month=1/090101.txt 0:115
|
|
NODE 5:
|
|
HDFS SPLIT hdfs://localhost:20500/test-warehouse/alltypestiny/year=2009/month=2/090201.txt 0:115
|
|
---- DISTRIBUTEDPLAN
|
|
13:EXCHANGE [PARTITION=UNPARTITIONED]
|
|
|
|
|
|--16:MERGE
|
|
| |
|
|
| 12:AGGREGATE [MERGE FINALIZE]
|
|
| | group by: id, bool_col, tinyint_col, smallint_col, int_col, bigint_col, float_col, double_col, date_string_col, string_col, timestamp_col, year, month
|
|
| |
|
|
| 11:EXCHANGE [PARTITION=HASH(id,bool_col,tinyint_col,smallint_col,int_col,bigint_col,float_col,double_col,date_string_col,string_col,timestamp_col,year,month)]
|
|
| |
|
|
| |--10:AGGREGATE
|
|
| | | group by: id, bool_col, tinyint_col, smallint_col, int_col, bigint_col, float_col, double_col, date_string_col, string_col, timestamp_col, year, month
|
|
| | |
|
|
| | 09:MERGE
|
|
| | |
|
|
| | 05:SCAN HDFS [functional.alltypestiny]
|
|
| | partitions=1/4 size=115B
|
|
| |
|
|
| 06:AGGREGATE
|
|
| | group by: id, bool_col, tinyint_col, smallint_col, int_col, bigint_col, float_col, double_col, date_string_col, string_col, timestamp_col, year, month
|
|
| |
|
|
| 08:MERGE
|
|
| |
|
|
| 04:SCAN HDFS [functional.alltypestiny]
|
|
| partitions=1/4 size=115B
|
|
|
|
|
|--15:MERGE
|
|
| |
|
|
| 02:SCAN HDFS [functional.alltypestiny]
|
|
| partitions=1/4 size=115B
|
|
|
|
|
14:MERGE
|
|
|
|
|
01:SCAN HDFS [functional.alltypestiny]
|
|
partitions=1/4 size=115B
|
|
====
|
|
// 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 functional.alltypestiny where year=2009 and month=1
|
|
union all
|
|
(select * from functional.alltypestiny where year=2009 and month=1
|
|
union distinct
|
|
select * from functional.alltypestiny where year=2009 and month=2
|
|
union all
|
|
(select * from functional.alltypestiny where year=2009 and month=2)
|
|
limit 10)
|
|
---- PLAN
|
|
00:MERGE
|
|
|
|
|
|--06:MERGE
|
|
| | limit: 10
|
|
| |
|
|
| |--05:AGGREGATE [FINALIZE]
|
|
| | | group by: id, bool_col, tinyint_col, smallint_col, int_col, bigint_col, float_col, double_col, date_string_col, string_col, timestamp_col, year, month
|
|
| | |
|
|
| | 02:MERGE
|
|
| | |
|
|
| | |--04:SCAN HDFS [functional.alltypestiny]
|
|
| | | partitions=1/4 size=115B
|
|
| | |
|
|
| | 03:SCAN HDFS [functional.alltypestiny]
|
|
| | partitions=1/4 size=115B
|
|
| |
|
|
| 07:SCAN HDFS [functional.alltypestiny]
|
|
| partitions=1/4 size=115B
|
|
|
|
|
01:SCAN HDFS [functional.alltypestiny]
|
|
partitions=1/4 size=115B
|
|
---- SCANRANGELOCATIONS
|
|
NODE 1:
|
|
HDFS SPLIT hdfs://localhost:20500/test-warehouse/alltypestiny/year=2009/month=1/090101.txt 0:115
|
|
NODE 3:
|
|
HDFS SPLIT hdfs://localhost:20500/test-warehouse/alltypestiny/year=2009/month=1/090101.txt 0:115
|
|
NODE 4:
|
|
HDFS SPLIT hdfs://localhost:20500/test-warehouse/alltypestiny/year=2009/month=2/090201.txt 0:115
|
|
NODE 7:
|
|
HDFS SPLIT hdfs://localhost:20500/test-warehouse/alltypestiny/year=2009/month=2/090201.txt 0:115
|
|
---- DISTRIBUTEDPLAN
|
|
17:EXCHANGE [PARTITION=UNPARTITIONED]
|
|
|
|
|
|--19:MERGE
|
|
| |
|
|
| 14:EXCHANGE [PARTITION=UNPARTITIONED]
|
|
| | limit: 10
|
|
| |
|
|
| |--16:MERGE
|
|
| | | limit: 10
|
|
| | |
|
|
| | 13:AGGREGATE [MERGE FINALIZE]
|
|
| | | group by: id, bool_col, tinyint_col, smallint_col, int_col, bigint_col, float_col, double_col, date_string_col, string_col, timestamp_col, year, month
|
|
| | |
|
|
| | 12:EXCHANGE [PARTITION=HASH(id,bool_col,tinyint_col,smallint_col,int_col,bigint_col,float_col,double_col,date_string_col,string_col,timestamp_col,year,month)]
|
|
| | |
|
|
| | |--11:AGGREGATE
|
|
| | | | group by: id, bool_col, tinyint_col, smallint_col, int_col, bigint_col, float_col, double_col, date_string_col, string_col, timestamp_col, year, month
|
|
| | | |
|
|
| | | 10:MERGE
|
|
| | | |
|
|
| | | 04:SCAN HDFS [functional.alltypestiny]
|
|
| | | partitions=1/4 size=115B
|
|
| | |
|
|
| | 05:AGGREGATE
|
|
| | | group by: id, bool_col, tinyint_col, smallint_col, int_col, bigint_col, float_col, double_col, date_string_col, string_col, timestamp_col, year, month
|
|
| | |
|
|
| | 09:MERGE
|
|
| | |
|
|
| | 03:SCAN HDFS [functional.alltypestiny]
|
|
| | partitions=1/4 size=115B
|
|
| |
|
|
| 15:MERGE
|
|
| | limit: 10
|
|
| |
|
|
| 07:SCAN HDFS [functional.alltypestiny]
|
|
| partitions=1/4 size=115B
|
|
|
|
|
18:MERGE
|
|
|
|
|
01:SCAN HDFS [functional.alltypestiny]
|
|
partitions=1/4 size=115B
|
|
====
|
|
// Union unnesting: UNION ALL doesn't absorb nested union with order by and limit,
|
|
// first operand is nested
|
|
(select * from functional.alltypestiny where year=2009 and month=1
|
|
union all
|
|
(select * from functional.alltypestiny where year=2009 and month=2)
|
|
order by 3 limit 3)
|
|
union all
|
|
select * from functional.alltypestiny where year=2009 and month=1
|
|
---- PLAN
|
|
00:MERGE
|
|
|
|
|
|--05:SCAN HDFS [functional.alltypestiny]
|
|
| partitions=1/4 size=115B
|
|
|
|
|
04:TOP-N [LIMIT=3]
|
|
| order by: tinyint_col ASC
|
|
|
|
|
01:MERGE
|
|
|
|
|
|--03:SCAN HDFS [functional.alltypestiny]
|
|
| partitions=1/4 size=115B
|
|
|
|
|
02:SCAN HDFS [functional.alltypestiny]
|
|
partitions=1/4 size=115B
|
|
---- SCANRANGELOCATIONS
|
|
NODE 2:
|
|
HDFS SPLIT hdfs://localhost:20500/test-warehouse/alltypestiny/year=2009/month=1/090101.txt 0:115
|
|
NODE 3:
|
|
HDFS SPLIT hdfs://localhost:20500/test-warehouse/alltypestiny/year=2009/month=2/090201.txt 0:115
|
|
NODE 5:
|
|
HDFS SPLIT hdfs://localhost:20500/test-warehouse/alltypestiny/year=2009/month=1/090101.txt 0:115
|
|
---- DISTRIBUTEDPLAN
|
|
12:EXCHANGE [PARTITION=UNPARTITIONED]
|
|
|
|
|
|--14:MERGE
|
|
| |
|
|
| 05:SCAN HDFS [functional.alltypestiny]
|
|
| partitions=1/4 size=115B
|
|
|
|
|
13:MERGE
|
|
|
|
|
11:TOP-N [LIMIT=3]
|
|
| order by: tinyint_col ASC
|
|
|
|
|
10:EXCHANGE [PARTITION=UNPARTITIONED]
|
|
|
|
|
|--09:TOP-N [LIMIT=3]
|
|
| | order by: tinyint_col ASC
|
|
| |
|
|
| 08:MERGE
|
|
| |
|
|
| 03:SCAN HDFS [functional.alltypestiny]
|
|
| partitions=1/4 size=115B
|
|
|
|
|
04:TOP-N [LIMIT=3]
|
|
| order by: tinyint_col ASC
|
|
|
|
|
07:MERGE
|
|
|
|
|
02:SCAN HDFS [functional.alltypestiny]
|
|
partitions=1/4 size=115B
|
|
====
|
|
// Union unnesting: UNION ALL doesn't absorb nested union with order by and limit,
|
|
// second operand is nested
|
|
select * from functional.alltypestiny where year=2009 and month=1
|
|
union all
|
|
(select * from functional.alltypestiny where year=2009 and month=1
|
|
union all
|
|
(select * from functional.alltypestiny where year=2009 and month=2)
|
|
order by 3 limit 3)
|
|
---- PLAN
|
|
00:MERGE
|
|
|
|
|
|--05:TOP-N [LIMIT=3]
|
|
| | order by: tinyint_col ASC
|
|
| |
|
|
| 02:MERGE
|
|
| |
|
|
| |--04:SCAN HDFS [functional.alltypestiny]
|
|
| | partitions=1/4 size=115B
|
|
| |
|
|
| 03:SCAN HDFS [functional.alltypestiny]
|
|
| partitions=1/4 size=115B
|
|
|
|
|
01:SCAN HDFS [functional.alltypestiny]
|
|
partitions=1/4 size=115B
|
|
---- SCANRANGELOCATIONS
|
|
NODE 1:
|
|
HDFS SPLIT hdfs://localhost:20500/test-warehouse/alltypestiny/year=2009/month=1/090101.txt 0:115
|
|
NODE 3:
|
|
HDFS SPLIT hdfs://localhost:20500/test-warehouse/alltypestiny/year=2009/month=1/090101.txt 0:115
|
|
NODE 4:
|
|
HDFS SPLIT hdfs://localhost:20500/test-warehouse/alltypestiny/year=2009/month=2/090201.txt 0:115
|
|
---- DISTRIBUTEDPLAN
|
|
12:EXCHANGE [PARTITION=UNPARTITIONED]
|
|
|
|
|
|--14:MERGE
|
|
| |
|
|
| 11:TOP-N [LIMIT=3]
|
|
| | order by: tinyint_col ASC
|
|
| |
|
|
| 10:EXCHANGE [PARTITION=UNPARTITIONED]
|
|
| |
|
|
| |--09:TOP-N [LIMIT=3]
|
|
| | | order by: tinyint_col ASC
|
|
| | |
|
|
| | 08:MERGE
|
|
| | |
|
|
| | 04:SCAN HDFS [functional.alltypestiny]
|
|
| | partitions=1/4 size=115B
|
|
| |
|
|
| 05:TOP-N [LIMIT=3]
|
|
| | order by: tinyint_col ASC
|
|
| |
|
|
| 07:MERGE
|
|
| |
|
|
| 03:SCAN HDFS [functional.alltypestiny]
|
|
| partitions=1/4 size=115B
|
|
|
|
|
13:MERGE
|
|
|
|
|
01:SCAN HDFS [functional.alltypestiny]
|
|
partitions=1/4 size=115B
|
|
====
|
|
// Union unnesting: UNION DISTINCT absorbs nested union with ALL
|
|
// first operand is nested
|
|
(select * from functional.alltypestiny where year=2009 and month=1
|
|
union all
|
|
select * from functional.alltypestiny where year=2009 and month=2)
|
|
union distinct
|
|
select * from functional.alltypestiny where year=2009 and month=1
|
|
---- PLAN
|
|
04:AGGREGATE [FINALIZE]
|
|
| group by: id, bool_col, tinyint_col, smallint_col, int_col, bigint_col, float_col, double_col, date_string_col, string_col, timestamp_col, year, month
|
|
|
|
|
00:MERGE
|
|
|
|
|
|--03:SCAN HDFS [functional.alltypestiny]
|
|
| partitions=1/4 size=115B
|
|
|
|
|
|--02:SCAN HDFS [functional.alltypestiny]
|
|
| partitions=1/4 size=115B
|
|
|
|
|
01:SCAN HDFS [functional.alltypestiny]
|
|
partitions=1/4 size=115B
|
|
---- SCANRANGELOCATIONS
|
|
NODE 1:
|
|
HDFS SPLIT hdfs://localhost:20500/test-warehouse/alltypestiny/year=2009/month=1/090101.txt 0:115
|
|
NODE 2:
|
|
HDFS SPLIT hdfs://localhost:20500/test-warehouse/alltypestiny/year=2009/month=2/090201.txt 0:115
|
|
NODE 3:
|
|
HDFS SPLIT hdfs://localhost:20500/test-warehouse/alltypestiny/year=2009/month=1/090101.txt 0:115
|
|
---- DISTRIBUTEDPLAN
|
|
13:EXCHANGE [PARTITION=UNPARTITIONED]
|
|
|
|
|
12:AGGREGATE [MERGE FINALIZE]
|
|
| group by: id, bool_col, tinyint_col, smallint_col, int_col, bigint_col, float_col, double_col, date_string_col, string_col, timestamp_col, year, month
|
|
|
|
|
11:EXCHANGE [PARTITION=HASH(id,bool_col,tinyint_col,smallint_col,int_col,bigint_col,float_col,double_col,date_string_col,string_col,timestamp_col,year,month)]
|
|
|
|
|
|--10:AGGREGATE
|
|
| | group by: id, bool_col, tinyint_col, smallint_col, int_col, bigint_col, float_col, double_col, date_string_col, string_col, timestamp_col, year, month
|
|
| |
|
|
| 08:MERGE
|
|
| |
|
|
| 03:SCAN HDFS [functional.alltypestiny]
|
|
| partitions=1/4 size=115B
|
|
|
|
|
|--09:AGGREGATE
|
|
| | group by: id, bool_col, tinyint_col, smallint_col, int_col, bigint_col, float_col, double_col, date_string_col, string_col, timestamp_col, year, month
|
|
| |
|
|
| 07:MERGE
|
|
| |
|
|
| 02:SCAN HDFS [functional.alltypestiny]
|
|
| partitions=1/4 size=115B
|
|
|
|
|
04:AGGREGATE
|
|
| group by: id, bool_col, tinyint_col, smallint_col, int_col, bigint_col, float_col, double_col, date_string_col, string_col, timestamp_col, year, month
|
|
|
|
|
06:MERGE
|
|
|
|
|
01:SCAN HDFS [functional.alltypestiny]
|
|
partitions=1/4 size=115B
|
|
====
|
|
// Union unnesting: UNION DISTINCT absorbs nested union with ALL,
|
|
// second operand is nested
|
|
select * from functional.alltypestiny where year=2009 and month=1
|
|
union distinct
|
|
(select * from functional.alltypestiny where year=2009 and month=1
|
|
union all
|
|
select * from functional.alltypestiny where year=2009 and month=2)
|
|
---- PLAN
|
|
04:AGGREGATE [FINALIZE]
|
|
| group by: id, bool_col, tinyint_col, smallint_col, int_col, bigint_col, float_col, double_col, date_string_col, string_col, timestamp_col, year, month
|
|
|
|
|
00:MERGE
|
|
|
|
|
|--03:SCAN HDFS [functional.alltypestiny]
|
|
| partitions=1/4 size=115B
|
|
|
|
|
|--02:SCAN HDFS [functional.alltypestiny]
|
|
| partitions=1/4 size=115B
|
|
|
|
|
01:SCAN HDFS [functional.alltypestiny]
|
|
partitions=1/4 size=115B
|
|
---- SCANRANGELOCATIONS
|
|
NODE 1:
|
|
HDFS SPLIT hdfs://localhost:20500/test-warehouse/alltypestiny/year=2009/month=1/090101.txt 0:115
|
|
NODE 2:
|
|
HDFS SPLIT hdfs://localhost:20500/test-warehouse/alltypestiny/year=2009/month=1/090101.txt 0:115
|
|
NODE 3:
|
|
HDFS SPLIT hdfs://localhost:20500/test-warehouse/alltypestiny/year=2009/month=2/090201.txt 0:115
|
|
---- DISTRIBUTEDPLAN
|
|
13:EXCHANGE [PARTITION=UNPARTITIONED]
|
|
|
|
|
12:AGGREGATE [MERGE FINALIZE]
|
|
| group by: id, bool_col, tinyint_col, smallint_col, int_col, bigint_col, float_col, double_col, date_string_col, string_col, timestamp_col, year, month
|
|
|
|
|
11:EXCHANGE [PARTITION=HASH(id,bool_col,tinyint_col,smallint_col,int_col,bigint_col,float_col,double_col,date_string_col,string_col,timestamp_col,year,month)]
|
|
|
|
|
|--10:AGGREGATE
|
|
| | group by: id, bool_col, tinyint_col, smallint_col, int_col, bigint_col, float_col, double_col, date_string_col, string_col, timestamp_col, year, month
|
|
| |
|
|
| 08:MERGE
|
|
| |
|
|
| 03:SCAN HDFS [functional.alltypestiny]
|
|
| partitions=1/4 size=115B
|
|
|
|
|
|--09:AGGREGATE
|
|
| | group by: id, bool_col, tinyint_col, smallint_col, int_col, bigint_col, float_col, double_col, date_string_col, string_col, timestamp_col, year, month
|
|
| |
|
|
| 07:MERGE
|
|
| |
|
|
| 02:SCAN HDFS [functional.alltypestiny]
|
|
| partitions=1/4 size=115B
|
|
|
|
|
04:AGGREGATE
|
|
| group by: id, bool_col, tinyint_col, smallint_col, int_col, bigint_col, float_col, double_col, date_string_col, string_col, timestamp_col, year, month
|
|
|
|
|
06:MERGE
|
|
|
|
|
01:SCAN HDFS [functional.alltypestiny]
|
|
partitions=1/4 size=115B
|
|
====
|
|
// Union unnesting: UNION DISTINCT absorbs nested union with mixed ALL/DISTINCT,
|
|
// first operand is nested
|
|
(select * from functional.alltypestiny where year=2009 and month=1
|
|
union distinct
|
|
select * from functional.alltypestiny where year=2009 and month=2
|
|
union all
|
|
select * from functional.alltypestiny where year=2009 and month=2)
|
|
union distinct
|
|
select * from functional.alltypestiny where year=2009 and month=1
|
|
---- PLAN
|
|
05:AGGREGATE [FINALIZE]
|
|
| group by: id, bool_col, tinyint_col, smallint_col, int_col, bigint_col, float_col, double_col, date_string_col, string_col, timestamp_col, year, month
|
|
|
|
|
00:MERGE
|
|
|
|
|
|--04:SCAN HDFS [functional.alltypestiny]
|
|
| partitions=1/4 size=115B
|
|
|
|
|
|--03:SCAN HDFS [functional.alltypestiny]
|
|
| partitions=1/4 size=115B
|
|
|
|
|
|--02:SCAN HDFS [functional.alltypestiny]
|
|
| partitions=1/4 size=115B
|
|
|
|
|
01:SCAN HDFS [functional.alltypestiny]
|
|
partitions=1/4 size=115B
|
|
---- SCANRANGELOCATIONS
|
|
NODE 1:
|
|
HDFS SPLIT hdfs://localhost:20500/test-warehouse/alltypestiny/year=2009/month=1/090101.txt 0:115
|
|
NODE 2:
|
|
HDFS SPLIT hdfs://localhost:20500/test-warehouse/alltypestiny/year=2009/month=2/090201.txt 0:115
|
|
NODE 3:
|
|
HDFS SPLIT hdfs://localhost:20500/test-warehouse/alltypestiny/year=2009/month=2/090201.txt 0:115
|
|
NODE 4:
|
|
HDFS SPLIT hdfs://localhost:20500/test-warehouse/alltypestiny/year=2009/month=1/090101.txt 0:115
|
|
---- DISTRIBUTEDPLAN
|
|
16:EXCHANGE [PARTITION=UNPARTITIONED]
|
|
|
|
|
15:AGGREGATE [MERGE FINALIZE]
|
|
| group by: id, bool_col, tinyint_col, smallint_col, int_col, bigint_col, float_col, double_col, date_string_col, string_col, timestamp_col, year, month
|
|
|
|
|
14:EXCHANGE [PARTITION=HASH(id,bool_col,tinyint_col,smallint_col,int_col,bigint_col,float_col,double_col,date_string_col,string_col,timestamp_col,year,month)]
|
|
|
|
|
|--13:AGGREGATE
|
|
| | group by: id, bool_col, tinyint_col, smallint_col, int_col, bigint_col, float_col, double_col, date_string_col, string_col, timestamp_col, year, month
|
|
| |
|
|
| 10:MERGE
|
|
| |
|
|
| 04:SCAN HDFS [functional.alltypestiny]
|
|
| partitions=1/4 size=115B
|
|
|
|
|
|--12:AGGREGATE
|
|
| | group by: id, bool_col, tinyint_col, smallint_col, int_col, bigint_col, float_col, double_col, date_string_col, string_col, timestamp_col, year, month
|
|
| |
|
|
| 09:MERGE
|
|
| |
|
|
| 03:SCAN HDFS [functional.alltypestiny]
|
|
| partitions=1/4 size=115B
|
|
|
|
|
|--11:AGGREGATE
|
|
| | group by: id, bool_col, tinyint_col, smallint_col, int_col, bigint_col, float_col, double_col, date_string_col, string_col, timestamp_col, year, month
|
|
| |
|
|
| 08:MERGE
|
|
| |
|
|
| 02:SCAN HDFS [functional.alltypestiny]
|
|
| partitions=1/4 size=115B
|
|
|
|
|
05:AGGREGATE
|
|
| group by: id, bool_col, tinyint_col, smallint_col, int_col, bigint_col, float_col, double_col, date_string_col, string_col, timestamp_col, year, month
|
|
|
|
|
07:MERGE
|
|
|
|
|
01:SCAN HDFS [functional.alltypestiny]
|
|
partitions=1/4 size=115B
|
|
====
|
|
// Union unnesting: UNION DISTINCT absorbs nested union with mixed ALL/DISTINCT,
|
|
// second operand is nested
|
|
select * from functional.alltypestiny where year=2009 and month=1
|
|
union distinct
|
|
(select * from functional.alltypestiny where year=2009 and month=1
|
|
union distinct
|
|
select * from functional.alltypestiny where year=2009 and month=2
|
|
union all
|
|
select * from functional.alltypestiny where year=2009 and month=2)
|
|
---- PLAN
|
|
05:AGGREGATE [FINALIZE]
|
|
| group by: id, bool_col, tinyint_col, smallint_col, int_col, bigint_col, float_col, double_col, date_string_col, string_col, timestamp_col, year, month
|
|
|
|
|
00:MERGE
|
|
|
|
|
|--04:SCAN HDFS [functional.alltypestiny]
|
|
| partitions=1/4 size=115B
|
|
|
|
|
|--03:SCAN HDFS [functional.alltypestiny]
|
|
| partitions=1/4 size=115B
|
|
|
|
|
|--02:SCAN HDFS [functional.alltypestiny]
|
|
| partitions=1/4 size=115B
|
|
|
|
|
01:SCAN HDFS [functional.alltypestiny]
|
|
partitions=1/4 size=115B
|
|
---- SCANRANGELOCATIONS
|
|
NODE 1:
|
|
HDFS SPLIT hdfs://localhost:20500/test-warehouse/alltypestiny/year=2009/month=1/090101.txt 0:115
|
|
NODE 2:
|
|
HDFS SPLIT hdfs://localhost:20500/test-warehouse/alltypestiny/year=2009/month=1/090101.txt 0:115
|
|
NODE 3:
|
|
HDFS SPLIT hdfs://localhost:20500/test-warehouse/alltypestiny/year=2009/month=2/090201.txt 0:115
|
|
NODE 4:
|
|
HDFS SPLIT hdfs://localhost:20500/test-warehouse/alltypestiny/year=2009/month=2/090201.txt 0:115
|
|
---- DISTRIBUTEDPLAN
|
|
16:EXCHANGE [PARTITION=UNPARTITIONED]
|
|
|
|
|
15:AGGREGATE [MERGE FINALIZE]
|
|
| group by: id, bool_col, tinyint_col, smallint_col, int_col, bigint_col, float_col, double_col, date_string_col, string_col, timestamp_col, year, month
|
|
|
|
|
14:EXCHANGE [PARTITION=HASH(id,bool_col,tinyint_col,smallint_col,int_col,bigint_col,float_col,double_col,date_string_col,string_col,timestamp_col,year,month)]
|
|
|
|
|
|--13:AGGREGATE
|
|
| | group by: id, bool_col, tinyint_col, smallint_col, int_col, bigint_col, float_col, double_col, date_string_col, string_col, timestamp_col, year, month
|
|
| |
|
|
| 10:MERGE
|
|
| |
|
|
| 04:SCAN HDFS [functional.alltypestiny]
|
|
| partitions=1/4 size=115B
|
|
|
|
|
|--12:AGGREGATE
|
|
| | group by: id, bool_col, tinyint_col, smallint_col, int_col, bigint_col, float_col, double_col, date_string_col, string_col, timestamp_col, year, month
|
|
| |
|
|
| 09:MERGE
|
|
| |
|
|
| 03:SCAN HDFS [functional.alltypestiny]
|
|
| partitions=1/4 size=115B
|
|
|
|
|
|--11:AGGREGATE
|
|
| | group by: id, bool_col, tinyint_col, smallint_col, int_col, bigint_col, float_col, double_col, date_string_col, string_col, timestamp_col, year, month
|
|
| |
|
|
| 08:MERGE
|
|
| |
|
|
| 02:SCAN HDFS [functional.alltypestiny]
|
|
| partitions=1/4 size=115B
|
|
|
|
|
05:AGGREGATE
|
|
| group by: id, bool_col, tinyint_col, smallint_col, int_col, bigint_col, float_col, double_col, date_string_col, string_col, timestamp_col, year, month
|
|
|
|
|
07:MERGE
|
|
|
|
|
01:SCAN HDFS [functional.alltypestiny]
|
|
partitions=1/4 size=115B
|
|
====
|
|
// Union unnesting: UNION DISTINCT doesn't absorb nested union with order by and limit,
|
|
// first operand is nested
|
|
(select * from functional.alltypestiny where year=2009 and month=1
|
|
union all
|
|
(select * from functional.alltypestiny where year=2009 and month=2)
|
|
order by 3 limit 3)
|
|
union distinct
|
|
select * from functional.alltypestiny where year=2009 and month=1
|
|
---- PLAN
|
|
06:AGGREGATE [FINALIZE]
|
|
| group by: id, bool_col, tinyint_col, smallint_col, int_col, bigint_col, float_col, double_col, date_string_col, string_col, timestamp_col, year, month
|
|
|
|
|
00:MERGE
|
|
|
|
|
|--05:SCAN HDFS [functional.alltypestiny]
|
|
| partitions=1/4 size=115B
|
|
|
|
|
04:TOP-N [LIMIT=3]
|
|
| order by: tinyint_col ASC
|
|
|
|
|
01:MERGE
|
|
|
|
|
|--03:SCAN HDFS [functional.alltypestiny]
|
|
| partitions=1/4 size=115B
|
|
|
|
|
02:SCAN HDFS [functional.alltypestiny]
|
|
partitions=1/4 size=115B
|
|
---- SCANRANGELOCATIONS
|
|
NODE 2:
|
|
HDFS SPLIT hdfs://localhost:20500/test-warehouse/alltypestiny/year=2009/month=1/090101.txt 0:115
|
|
NODE 3:
|
|
HDFS SPLIT hdfs://localhost:20500/test-warehouse/alltypestiny/year=2009/month=2/090201.txt 0:115
|
|
NODE 5:
|
|
HDFS SPLIT hdfs://localhost:20500/test-warehouse/alltypestiny/year=2009/month=1/090101.txt 0:115
|
|
---- DISTRIBUTEDPLAN
|
|
19:EXCHANGE [PARTITION=UNPARTITIONED]
|
|
|
|
|
18:AGGREGATE [MERGE FINALIZE]
|
|
| group by: id, bool_col, tinyint_col, smallint_col, int_col, bigint_col, float_col, double_col, date_string_col, string_col, timestamp_col, year, month
|
|
|
|
|
17:EXCHANGE [PARTITION=HASH(id,bool_col,tinyint_col,smallint_col,int_col,bigint_col,float_col,double_col,date_string_col,string_col,timestamp_col,year,month)]
|
|
|
|
|
|--16:AGGREGATE
|
|
| | group by: id, bool_col, tinyint_col, smallint_col, int_col, bigint_col, float_col, double_col, date_string_col, string_col, timestamp_col, year, month
|
|
| |
|
|
| 15:MERGE
|
|
| |
|
|
| 05:SCAN HDFS [functional.alltypestiny]
|
|
| partitions=1/4 size=115B
|
|
|
|
|
06:AGGREGATE
|
|
| group by: id, bool_col, tinyint_col, smallint_col, int_col, bigint_col, float_col, double_col, date_string_col, string_col, timestamp_col, year, month
|
|
|
|
|
14:MERGE
|
|
|
|
|
12:TOP-N [LIMIT=3]
|
|
| order by: tinyint_col ASC
|
|
|
|
|
11:EXCHANGE [PARTITION=UNPARTITIONED]
|
|
|
|
|
|--10:TOP-N [LIMIT=3]
|
|
| | order by: tinyint_col ASC
|
|
| |
|
|
| 09:MERGE
|
|
| |
|
|
| 03:SCAN HDFS [functional.alltypestiny]
|
|
| partitions=1/4 size=115B
|
|
|
|
|
04:TOP-N [LIMIT=3]
|
|
| order by: tinyint_col ASC
|
|
|
|
|
08:MERGE
|
|
|
|
|
02:SCAN HDFS [functional.alltypestiny]
|
|
partitions=1/4 size=115B
|
|
====
|
|
// Union unnesting: UNION DISTINCT doesn't absorb nested union with order by and limit
|
|
// second operand is nested
|
|
select * from functional.alltypestiny where year=2009 and month=1
|
|
union distinct
|
|
(select * from functional.alltypestiny where year=2009 and month=1
|
|
union all
|
|
(select * from functional.alltypestiny where year=2009 and month=2)
|
|
order by 3 limit 3)
|
|
---- PLAN
|
|
06:AGGREGATE [FINALIZE]
|
|
| group by: id, bool_col, tinyint_col, smallint_col, int_col, bigint_col, float_col, double_col, date_string_col, string_col, timestamp_col, year, month
|
|
|
|
|
00:MERGE
|
|
|
|
|
|--05:TOP-N [LIMIT=3]
|
|
| | order by: tinyint_col ASC
|
|
| |
|
|
| 02:MERGE
|
|
| |
|
|
| |--04:SCAN HDFS [functional.alltypestiny]
|
|
| | partitions=1/4 size=115B
|
|
| |
|
|
| 03:SCAN HDFS [functional.alltypestiny]
|
|
| partitions=1/4 size=115B
|
|
|
|
|
01:SCAN HDFS [functional.alltypestiny]
|
|
partitions=1/4 size=115B
|
|
---- SCANRANGELOCATIONS
|
|
NODE 1:
|
|
HDFS SPLIT hdfs://localhost:20500/test-warehouse/alltypestiny/year=2009/month=1/090101.txt 0:115
|
|
NODE 3:
|
|
HDFS SPLIT hdfs://localhost:20500/test-warehouse/alltypestiny/year=2009/month=1/090101.txt 0:115
|
|
NODE 4:
|
|
HDFS SPLIT hdfs://localhost:20500/test-warehouse/alltypestiny/year=2009/month=2/090201.txt 0:115
|
|
---- DISTRIBUTEDPLAN
|
|
19:EXCHANGE [PARTITION=UNPARTITIONED]
|
|
|
|
|
18:AGGREGATE [MERGE FINALIZE]
|
|
| group by: id, bool_col, tinyint_col, smallint_col, int_col, bigint_col, float_col, double_col, date_string_col, string_col, timestamp_col, year, month
|
|
|
|
|
17:EXCHANGE [PARTITION=HASH(id,bool_col,tinyint_col,smallint_col,int_col,bigint_col,float_col,double_col,date_string_col,string_col,timestamp_col,year,month)]
|
|
|
|
|
|--16:AGGREGATE
|
|
| | group by: id, bool_col, tinyint_col, smallint_col, int_col, bigint_col, float_col, double_col, date_string_col, string_col, timestamp_col, year, month
|
|
| |
|
|
| 15:MERGE
|
|
| |
|
|
| 12:TOP-N [LIMIT=3]
|
|
| | order by: tinyint_col ASC
|
|
| |
|
|
| 11:EXCHANGE [PARTITION=UNPARTITIONED]
|
|
| |
|
|
| |--10:TOP-N [LIMIT=3]
|
|
| | | order by: tinyint_col ASC
|
|
| | |
|
|
| | 09:MERGE
|
|
| | |
|
|
| | 04:SCAN HDFS [functional.alltypestiny]
|
|
| | partitions=1/4 size=115B
|
|
| |
|
|
| 05:TOP-N [LIMIT=3]
|
|
| | order by: tinyint_col ASC
|
|
| |
|
|
| 08:MERGE
|
|
| |
|
|
| 03:SCAN HDFS [functional.alltypestiny]
|
|
| partitions=1/4 size=115B
|
|
|
|
|
06:AGGREGATE
|
|
| group by: id, bool_col, tinyint_col, smallint_col, int_col, bigint_col, float_col, double_col, date_string_col, string_col, timestamp_col, year, month
|
|
|
|
|
14:MERGE
|
|
|
|
|
01:SCAN HDFS [functional.alltypestiny]
|
|
partitions=1/4 size=115B
|
|
====
|
|
// Complex union unnesting: Multiple levels of UNION ALL, fully unnestable
|
|
select * from functional.alltypestiny where year=2009 and month=1
|
|
union all
|
|
(select * from functional.alltypestiny where year=2009 and month=1
|
|
union all
|
|
(select * from functional.alltypestiny where year=2009 and month=2
|
|
union all
|
|
(select * from functional.alltypestiny where year=2009 and month=2
|
|
union all
|
|
select * from functional.alltypestiny where year=2009 and month=3)))
|
|
---- PLAN
|
|
00:MERGE
|
|
|
|
|
|--05:SCAN HDFS [functional.alltypestiny]
|
|
| partitions=1/4 size=115B
|
|
|
|
|
|--04:SCAN HDFS [functional.alltypestiny]
|
|
| partitions=1/4 size=115B
|
|
|
|
|
|--03:SCAN HDFS [functional.alltypestiny]
|
|
| partitions=1/4 size=115B
|
|
|
|
|
|--02:SCAN HDFS [functional.alltypestiny]
|
|
| partitions=1/4 size=115B
|
|
|
|
|
01:SCAN HDFS [functional.alltypestiny]
|
|
partitions=1/4 size=115B
|
|
---- SCANRANGELOCATIONS
|
|
NODE 1:
|
|
HDFS SPLIT hdfs://localhost:20500/test-warehouse/alltypestiny/year=2009/month=1/090101.txt 0:115
|
|
NODE 2:
|
|
HDFS SPLIT hdfs://localhost:20500/test-warehouse/alltypestiny/year=2009/month=1/090101.txt 0:115
|
|
NODE 3:
|
|
HDFS SPLIT hdfs://localhost:20500/test-warehouse/alltypestiny/year=2009/month=2/090201.txt 0:115
|
|
NODE 4:
|
|
HDFS SPLIT hdfs://localhost:20500/test-warehouse/alltypestiny/year=2009/month=2/090201.txt 0:115
|
|
NODE 5:
|
|
HDFS SPLIT hdfs://localhost:20500/test-warehouse/alltypestiny/year=2009/month=3/090301.txt 0:115
|
|
---- DISTRIBUTEDPLAN
|
|
06:EXCHANGE [PARTITION=UNPARTITIONED]
|
|
|
|
|
|--11:MERGE
|
|
| |
|
|
| 05:SCAN HDFS [functional.alltypestiny]
|
|
| partitions=1/4 size=115B
|
|
|
|
|
|--10:MERGE
|
|
| |
|
|
| 04:SCAN HDFS [functional.alltypestiny]
|
|
| partitions=1/4 size=115B
|
|
|
|
|
|--09:MERGE
|
|
| |
|
|
| 03:SCAN HDFS [functional.alltypestiny]
|
|
| partitions=1/4 size=115B
|
|
|
|
|
|--08:MERGE
|
|
| |
|
|
| 02:SCAN HDFS [functional.alltypestiny]
|
|
| partitions=1/4 size=115B
|
|
|
|
|
07:MERGE
|
|
|
|
|
01:SCAN HDFS [functional.alltypestiny]
|
|
partitions=1/4 size=115B
|
|
====
|
|
// Complex union unnesting: Multiple levels of UNION DISTINCT, fully unnestable
|
|
select * from functional.alltypestiny where year=2009 and month=1
|
|
union distinct
|
|
(select * from functional.alltypestiny where year=2009 and month=1
|
|
union distinct
|
|
(select * from functional.alltypestiny where year=2009 and month=2
|
|
union distinct
|
|
(select * from functional.alltypestiny where year=2009 and month=2
|
|
union distinct
|
|
select * from functional.alltypestiny where year=2009 and month=3)))
|
|
---- PLAN
|
|
06:AGGREGATE [FINALIZE]
|
|
| group by: id, bool_col, tinyint_col, smallint_col, int_col, bigint_col, float_col, double_col, date_string_col, string_col, timestamp_col, year, month
|
|
|
|
|
00:MERGE
|
|
|
|
|
|--05:SCAN HDFS [functional.alltypestiny]
|
|
| partitions=1/4 size=115B
|
|
|
|
|
|--04:SCAN HDFS [functional.alltypestiny]
|
|
| partitions=1/4 size=115B
|
|
|
|
|
|--03:SCAN HDFS [functional.alltypestiny]
|
|
| partitions=1/4 size=115B
|
|
|
|
|
|--02:SCAN HDFS [functional.alltypestiny]
|
|
| partitions=1/4 size=115B
|
|
|
|
|
01:SCAN HDFS [functional.alltypestiny]
|
|
partitions=1/4 size=115B
|
|
---- SCANRANGELOCATIONS
|
|
NODE 1:
|
|
HDFS SPLIT hdfs://localhost:20500/test-warehouse/alltypestiny/year=2009/month=1/090101.txt 0:115
|
|
NODE 2:
|
|
HDFS SPLIT hdfs://localhost:20500/test-warehouse/alltypestiny/year=2009/month=1/090101.txt 0:115
|
|
NODE 3:
|
|
HDFS SPLIT hdfs://localhost:20500/test-warehouse/alltypestiny/year=2009/month=2/090201.txt 0:115
|
|
NODE 4:
|
|
HDFS SPLIT hdfs://localhost:20500/test-warehouse/alltypestiny/year=2009/month=2/090201.txt 0:115
|
|
NODE 5:
|
|
HDFS SPLIT hdfs://localhost:20500/test-warehouse/alltypestiny/year=2009/month=3/090301.txt 0:115
|
|
---- DISTRIBUTEDPLAN
|
|
19:EXCHANGE [PARTITION=UNPARTITIONED]
|
|
|
|
|
18:AGGREGATE [MERGE FINALIZE]
|
|
| group by: id, bool_col, tinyint_col, smallint_col, int_col, bigint_col, float_col, double_col, date_string_col, string_col, timestamp_col, year, month
|
|
|
|
|
17:EXCHANGE [PARTITION=HASH(id,bool_col,tinyint_col,smallint_col,int_col,bigint_col,float_col,double_col,date_string_col,string_col,timestamp_col,year,month)]
|
|
|
|
|
|--16:AGGREGATE
|
|
| | group by: id, bool_col, tinyint_col, smallint_col, int_col, bigint_col, float_col, double_col, date_string_col, string_col, timestamp_col, year, month
|
|
| |
|
|
| 12:MERGE
|
|
| |
|
|
| 05:SCAN HDFS [functional.alltypestiny]
|
|
| partitions=1/4 size=115B
|
|
|
|
|
|--15:AGGREGATE
|
|
| | group by: id, bool_col, tinyint_col, smallint_col, int_col, bigint_col, float_col, double_col, date_string_col, string_col, timestamp_col, year, month
|
|
| |
|
|
| 11:MERGE
|
|
| |
|
|
| 04:SCAN HDFS [functional.alltypestiny]
|
|
| partitions=1/4 size=115B
|
|
|
|
|
|--14:AGGREGATE
|
|
| | group by: id, bool_col, tinyint_col, smallint_col, int_col, bigint_col, float_col, double_col, date_string_col, string_col, timestamp_col, year, month
|
|
| |
|
|
| 10:MERGE
|
|
| |
|
|
| 03:SCAN HDFS [functional.alltypestiny]
|
|
| partitions=1/4 size=115B
|
|
|
|
|
|--13:AGGREGATE
|
|
| | group by: id, bool_col, tinyint_col, smallint_col, int_col, bigint_col, float_col, double_col, date_string_col, string_col, timestamp_col, year, month
|
|
| |
|
|
| 09:MERGE
|
|
| |
|
|
| 02:SCAN HDFS [functional.alltypestiny]
|
|
| partitions=1/4 size=115B
|
|
|
|
|
06:AGGREGATE
|
|
| group by: id, bool_col, tinyint_col, smallint_col, int_col, bigint_col, float_col, double_col, date_string_col, string_col, timestamp_col, year, month
|
|
|
|
|
08:MERGE
|
|
|
|
|
01:SCAN HDFS [functional.alltypestiny]
|
|
partitions=1/4 size=115B
|
|
====
|
|
// Complex union unnesting: Partially unnestable up to 2nd level
|
|
select * from functional.alltypestiny where year=2009 and month=1
|
|
union all
|
|
(select * from functional.alltypestiny where year=2009 and month=1
|
|
union distinct
|
|
(select * from functional.alltypestiny where year=2009 and month=2
|
|
union all
|
|
(select * from functional.alltypestiny where year=2009 and month=2
|
|
union distinct
|
|
(select * from functional.alltypestiny where year=2009 and month=3)
|
|
order by 3 limit 3)))
|
|
---- PLAN
|
|
00:MERGE
|
|
|
|
|
|--10:AGGREGATE [FINALIZE]
|
|
| | group by: id, bool_col, tinyint_col, smallint_col, int_col, bigint_col, float_col, double_col, date_string_col, string_col, timestamp_col, year, month
|
|
| |
|
|
| 02:MERGE
|
|
| |
|
|
| |--09:TOP-N [LIMIT=3]
|
|
| | | order by: tinyint_col ASC
|
|
| | |
|
|
| | 08:AGGREGATE [FINALIZE]
|
|
| | | group by: id, bool_col, tinyint_col, smallint_col, int_col, bigint_col, float_col, double_col, date_string_col, string_col, timestamp_col, year, month
|
|
| | |
|
|
| | 05:MERGE
|
|
| | |
|
|
| | |--07:SCAN HDFS [functional.alltypestiny]
|
|
| | | partitions=1/4 size=115B
|
|
| | |
|
|
| | 06:SCAN HDFS [functional.alltypestiny]
|
|
| | partitions=1/4 size=115B
|
|
| |
|
|
| |--04:SCAN HDFS [functional.alltypestiny]
|
|
| | partitions=1/4 size=115B
|
|
| |
|
|
| 03:SCAN HDFS [functional.alltypestiny]
|
|
| partitions=1/4 size=115B
|
|
|
|
|
01:SCAN HDFS [functional.alltypestiny]
|
|
partitions=1/4 size=115B
|
|
---- SCANRANGELOCATIONS
|
|
NODE 1:
|
|
HDFS SPLIT hdfs://localhost:20500/test-warehouse/alltypestiny/year=2009/month=1/090101.txt 0:115
|
|
NODE 3:
|
|
HDFS SPLIT hdfs://localhost:20500/test-warehouse/alltypestiny/year=2009/month=1/090101.txt 0:115
|
|
NODE 4:
|
|
HDFS SPLIT hdfs://localhost:20500/test-warehouse/alltypestiny/year=2009/month=2/090201.txt 0:115
|
|
NODE 6:
|
|
HDFS SPLIT hdfs://localhost:20500/test-warehouse/alltypestiny/year=2009/month=2/090201.txt 0:115
|
|
NODE 7:
|
|
HDFS SPLIT hdfs://localhost:20500/test-warehouse/alltypestiny/year=2009/month=3/090301.txt 0:115
|
|
---- DISTRIBUTEDPLAN
|
|
27:EXCHANGE [PARTITION=UNPARTITIONED]
|
|
|
|
|
|--29:MERGE
|
|
| |
|
|
| 26:AGGREGATE [MERGE FINALIZE]
|
|
| | group by: id, bool_col, tinyint_col, smallint_col, int_col, bigint_col, float_col, double_col, date_string_col, string_col, timestamp_col, year, month
|
|
| |
|
|
| 25:EXCHANGE [PARTITION=HASH(id,bool_col,tinyint_col,smallint_col,int_col,bigint_col,float_col,double_col,date_string_col,string_col,timestamp_col,year,month)]
|
|
| |
|
|
| |--24:AGGREGATE
|
|
| | | group by: id, bool_col, tinyint_col, smallint_col, int_col, bigint_col, float_col, double_col, date_string_col, string_col, timestamp_col, year, month
|
|
| | |
|
|
| | 22:MERGE
|
|
| | |
|
|
| | 18:TOP-N [LIMIT=3]
|
|
| | | order by: tinyint_col ASC
|
|
| | |
|
|
| | 17:EXCHANGE [PARTITION=UNPARTITIONED]
|
|
| | |
|
|
| | 09:TOP-N [LIMIT=3]
|
|
| | | order by: tinyint_col ASC
|
|
| | |
|
|
| | 16:AGGREGATE [MERGE FINALIZE]
|
|
| | | group by: id, bool_col, tinyint_col, smallint_col, int_col, bigint_col, float_col, double_col, date_string_col, string_col, timestamp_col, year, month
|
|
| | |
|
|
| | 15:EXCHANGE [PARTITION=HASH(id,bool_col,tinyint_col,smallint_col,int_col,bigint_col,float_col,double_col,date_string_col,string_col,timestamp_col,year,month)]
|
|
| | |
|
|
| | |--14:AGGREGATE
|
|
| | | | group by: id, bool_col, tinyint_col, smallint_col, int_col, bigint_col, float_col, double_col, date_string_col, string_col, timestamp_col, year, month
|
|
| | | |
|
|
| | | 13:MERGE
|
|
| | | |
|
|
| | | 07:SCAN HDFS [functional.alltypestiny]
|
|
| | | partitions=1/4 size=115B
|
|
| | |
|
|
| | 08:AGGREGATE
|
|
| | | group by: id, bool_col, tinyint_col, smallint_col, int_col, bigint_col, float_col, double_col, date_string_col, string_col, timestamp_col, year, month
|
|
| | |
|
|
| | 12:MERGE
|
|
| | |
|
|
| | 06:SCAN HDFS [functional.alltypestiny]
|
|
| | partitions=1/4 size=115B
|
|
| |
|
|
| |--23:AGGREGATE
|
|
| | | group by: id, bool_col, tinyint_col, smallint_col, int_col, bigint_col, float_col, double_col, date_string_col, string_col, timestamp_col, year, month
|
|
| | |
|
|
| | 21:MERGE
|
|
| | |
|
|
| | 04:SCAN HDFS [functional.alltypestiny]
|
|
| | partitions=1/4 size=115B
|
|
| |
|
|
| 10:AGGREGATE
|
|
| | group by: id, bool_col, tinyint_col, smallint_col, int_col, bigint_col, float_col, double_col, date_string_col, string_col, timestamp_col, year, month
|
|
| |
|
|
| 20:MERGE
|
|
| |
|
|
| 03:SCAN HDFS [functional.alltypestiny]
|
|
| partitions=1/4 size=115B
|
|
|
|
|
28:MERGE
|
|
|
|
|
01:SCAN HDFS [functional.alltypestiny]
|
|
partitions=1/4 size=115B
|
|
====
|
|
// Complex union unnesting: Partially unnestable up to 1st level
|
|
select * from functional.alltypestiny where year=2009 and month=1
|
|
union distinct
|
|
(select * from functional.alltypestiny where year=2009 and month=1
|
|
union distinct
|
|
(select * from functional.alltypestiny where year=2009 and month=2
|
|
union all
|
|
(select * from functional.alltypestiny where year=2009 and month=2
|
|
union distinct
|
|
(select * from functional.alltypestiny where year=2009 and month=3)
|
|
order by 3 limit 3)))
|
|
---- PLAN
|
|
09:AGGREGATE [FINALIZE]
|
|
| group by: id, bool_col, tinyint_col, smallint_col, int_col, bigint_col, float_col, double_col, date_string_col, string_col, timestamp_col, year, month
|
|
|
|
|
00:MERGE
|
|
|
|
|
|--08:TOP-N [LIMIT=3]
|
|
| | order by: tinyint_col ASC
|
|
| |
|
|
| 07:AGGREGATE [FINALIZE]
|
|
| | group by: id, bool_col, tinyint_col, smallint_col, int_col, bigint_col, float_col, double_col, date_string_col, string_col, timestamp_col, year, month
|
|
| |
|
|
| 04:MERGE
|
|
| |
|
|
| |--06:SCAN HDFS [functional.alltypestiny]
|
|
| | partitions=1/4 size=115B
|
|
| |
|
|
| 05:SCAN HDFS [functional.alltypestiny]
|
|
| partitions=1/4 size=115B
|
|
|
|
|
|--03:SCAN HDFS [functional.alltypestiny]
|
|
| partitions=1/4 size=115B
|
|
|
|
|
|--02:SCAN HDFS [functional.alltypestiny]
|
|
| partitions=1/4 size=115B
|
|
|
|
|
01:SCAN HDFS [functional.alltypestiny]
|
|
partitions=1/4 size=115B
|
|
---- SCANRANGELOCATIONS
|
|
NODE 1:
|
|
HDFS SPLIT hdfs://localhost:20500/test-warehouse/alltypestiny/year=2009/month=1/090101.txt 0:115
|
|
NODE 2:
|
|
HDFS SPLIT hdfs://localhost:20500/test-warehouse/alltypestiny/year=2009/month=1/090101.txt 0:115
|
|
NODE 3:
|
|
HDFS SPLIT hdfs://localhost:20500/test-warehouse/alltypestiny/year=2009/month=2/090201.txt 0:115
|
|
NODE 5:
|
|
HDFS SPLIT hdfs://localhost:20500/test-warehouse/alltypestiny/year=2009/month=2/090201.txt 0:115
|
|
NODE 6:
|
|
HDFS SPLIT hdfs://localhost:20500/test-warehouse/alltypestiny/year=2009/month=3/090301.txt 0:115
|
|
---- DISTRIBUTEDPLAN
|
|
28:EXCHANGE [PARTITION=UNPARTITIONED]
|
|
|
|
|
27:AGGREGATE [MERGE FINALIZE]
|
|
| group by: id, bool_col, tinyint_col, smallint_col, int_col, bigint_col, float_col, double_col, date_string_col, string_col, timestamp_col, year, month
|
|
|
|
|
26:EXCHANGE [PARTITION=HASH(id,bool_col,tinyint_col,smallint_col,int_col,bigint_col,float_col,double_col,date_string_col,string_col,timestamp_col,year,month)]
|
|
|
|
|
|--25:AGGREGATE
|
|
| | group by: id, bool_col, tinyint_col, smallint_col, int_col, bigint_col, float_col, double_col, date_string_col, string_col, timestamp_col, year, month
|
|
| |
|
|
| 22:MERGE
|
|
| |
|
|
| 17:TOP-N [LIMIT=3]
|
|
| | order by: tinyint_col ASC
|
|
| |
|
|
| 16:EXCHANGE [PARTITION=UNPARTITIONED]
|
|
| |
|
|
| 08:TOP-N [LIMIT=3]
|
|
| | order by: tinyint_col ASC
|
|
| |
|
|
| 15:AGGREGATE [MERGE FINALIZE]
|
|
| | group by: id, bool_col, tinyint_col, smallint_col, int_col, bigint_col, float_col, double_col, date_string_col, string_col, timestamp_col, year, month
|
|
| |
|
|
| 14:EXCHANGE [PARTITION=HASH(id,bool_col,tinyint_col,smallint_col,int_col,bigint_col,float_col,double_col,date_string_col,string_col,timestamp_col,year,month)]
|
|
| |
|
|
| |--13:AGGREGATE
|
|
| | | group by: id, bool_col, tinyint_col, smallint_col, int_col, bigint_col, float_col, double_col, date_string_col, string_col, timestamp_col, year, month
|
|
| | |
|
|
| | 12:MERGE
|
|
| | |
|
|
| | 06:SCAN HDFS [functional.alltypestiny]
|
|
| | partitions=1/4 size=115B
|
|
| |
|
|
| 07:AGGREGATE
|
|
| | group by: id, bool_col, tinyint_col, smallint_col, int_col, bigint_col, float_col, double_col, date_string_col, string_col, timestamp_col, year, month
|
|
| |
|
|
| 11:MERGE
|
|
| |
|
|
| 05:SCAN HDFS [functional.alltypestiny]
|
|
| partitions=1/4 size=115B
|
|
|
|
|
|--24:AGGREGATE
|
|
| | group by: id, bool_col, tinyint_col, smallint_col, int_col, bigint_col, float_col, double_col, date_string_col, string_col, timestamp_col, year, month
|
|
| |
|
|
| 21:MERGE
|
|
| |
|
|
| 03:SCAN HDFS [functional.alltypestiny]
|
|
| partitions=1/4 size=115B
|
|
|
|
|
|--23:AGGREGATE
|
|
| | group by: id, bool_col, tinyint_col, smallint_col, int_col, bigint_col, float_col, double_col, date_string_col, string_col, timestamp_col, year, month
|
|
| |
|
|
| 20:MERGE
|
|
| |
|
|
| 02:SCAN HDFS [functional.alltypestiny]
|
|
| partitions=1/4 size=115B
|
|
|
|
|
09:AGGREGATE
|
|
| group by: id, bool_col, tinyint_col, smallint_col, int_col, bigint_col, float_col, double_col, date_string_col, string_col, timestamp_col, year, month
|
|
|
|
|
19:MERGE
|
|
|
|
|
01:SCAN HDFS [functional.alltypestiny]
|
|
partitions=1/4 size=115B
|
|
====
|
|
// Complex union unnesting: Multiple nested unions to test all rules in a single query
|
|
select * from functional.alltypestiny where year=2009 and month=1
|
|
union distinct
|
|
(select * from functional.alltypestiny where year=2009 and month=1
|
|
union all
|
|
select * from functional.alltypestiny where year=2009 and month=2)
|
|
union distinct
|
|
(select * from functional.alltypestiny where year=2009 and month=2
|
|
union all
|
|
(select * from functional.alltypestiny where year=2009 and month=3)
|
|
order by 3 limit 3)
|
|
union all
|
|
(select * from functional.alltypestiny where year=2009 and month=3
|
|
union all
|
|
select * from functional.alltypestiny where year=2009 and month=4)
|
|
union all
|
|
(select * from functional.alltypestiny where year=2009 and month=4
|
|
union all
|
|
(select * from functional.alltypestiny where year=2009 and month=5)
|
|
order by 3 limit 3)
|
|
---- PLAN
|
|
09:MERGE
|
|
|
|
|
|--08:AGGREGATE [FINALIZE]
|
|
| | group by: id, bool_col, tinyint_col, smallint_col, int_col, bigint_col, float_col, double_col, date_string_col, string_col, timestamp_col, year, month
|
|
| |
|
|
| 00:MERGE
|
|
| |
|
|
| |--07:TOP-N [LIMIT=3]
|
|
| | | order by: tinyint_col ASC
|
|
| | |
|
|
| | 04:MERGE
|
|
| | |
|
|
| | |--06:SCAN HDFS [functional.alltypestiny]
|
|
| | | partitions=1/4 size=115B
|
|
| | |
|
|
| | 05:SCAN HDFS [functional.alltypestiny]
|
|
| | partitions=1/4 size=115B
|
|
| |
|
|
| |--03:SCAN HDFS [functional.alltypestiny]
|
|
| | partitions=1/4 size=115B
|
|
| |
|
|
| |--02:SCAN HDFS [functional.alltypestiny]
|
|
| | partitions=1/4 size=115B
|
|
| |
|
|
| 01:SCAN HDFS [functional.alltypestiny]
|
|
| partitions=1/4 size=115B
|
|
|
|
|
|--15:TOP-N [LIMIT=3]
|
|
| | order by: tinyint_col ASC
|
|
| |
|
|
| 12:MERGE
|
|
| |
|
|
| |--14:SCAN HDFS [functional.alltypestiny]
|
|
| | partitions=0/4 size=0B
|
|
| |
|
|
| 13:SCAN HDFS [functional.alltypestiny]
|
|
| partitions=1/4 size=115B
|
|
|
|
|
|--11:SCAN HDFS [functional.alltypestiny]
|
|
| partitions=1/4 size=115B
|
|
|
|
|
10:SCAN HDFS [functional.alltypestiny]
|
|
partitions=1/4 size=115B
|
|
---- SCANRANGELOCATIONS
|
|
NODE 1:
|
|
HDFS SPLIT hdfs://localhost:20500/test-warehouse/alltypestiny/year=2009/month=1/090101.txt 0:115
|
|
NODE 2:
|
|
HDFS SPLIT hdfs://localhost:20500/test-warehouse/alltypestiny/year=2009/month=1/090101.txt 0:115
|
|
NODE 3:
|
|
HDFS SPLIT hdfs://localhost:20500/test-warehouse/alltypestiny/year=2009/month=2/090201.txt 0:115
|
|
NODE 5:
|
|
HDFS SPLIT hdfs://localhost:20500/test-warehouse/alltypestiny/year=2009/month=2/090201.txt 0:115
|
|
NODE 6:
|
|
HDFS SPLIT hdfs://localhost:20500/test-warehouse/alltypestiny/year=2009/month=3/090301.txt 0:115
|
|
NODE 10:
|
|
HDFS SPLIT hdfs://localhost:20500/test-warehouse/alltypestiny/year=2009/month=3/090301.txt 0:115
|
|
NODE 11:
|
|
HDFS SPLIT hdfs://localhost:20500/test-warehouse/alltypestiny/year=2009/month=4/090401.txt 0:115
|
|
NODE 13:
|
|
HDFS SPLIT hdfs://localhost:20500/test-warehouse/alltypestiny/year=2009/month=4/090401.txt 0:115
|
|
NODE 14:
|
|
---- DISTRIBUTEDPLAN
|
|
38:EXCHANGE [PARTITION=UNPARTITIONED]
|
|
|
|
|
|--42:MERGE
|
|
| |
|
|
| 37:AGGREGATE [MERGE FINALIZE]
|
|
| | group by: id, bool_col, tinyint_col, smallint_col, int_col, bigint_col, float_col, double_col, date_string_col, string_col, timestamp_col, year, month
|
|
| |
|
|
| 36:EXCHANGE [PARTITION=HASH(id,bool_col,tinyint_col,smallint_col,int_col,bigint_col,float_col,double_col,date_string_col,string_col,timestamp_col,year,month)]
|
|
| |
|
|
| |--35:AGGREGATE
|
|
| | | group by: id, bool_col, tinyint_col, smallint_col, int_col, bigint_col, float_col, double_col, date_string_col, string_col, timestamp_col, year, month
|
|
| | |
|
|
| | 32:MERGE
|
|
| | |
|
|
| | 27:TOP-N [LIMIT=3]
|
|
| | | order by: tinyint_col ASC
|
|
| | |
|
|
| | 26:EXCHANGE [PARTITION=UNPARTITIONED]
|
|
| | |
|
|
| | |--25:TOP-N [LIMIT=3]
|
|
| | | | order by: tinyint_col ASC
|
|
| | | |
|
|
| | | 24:MERGE
|
|
| | | |
|
|
| | | 06:SCAN HDFS [functional.alltypestiny]
|
|
| | | partitions=1/4 size=115B
|
|
| | |
|
|
| | 07:TOP-N [LIMIT=3]
|
|
| | | order by: tinyint_col ASC
|
|
| | |
|
|
| | 23:MERGE
|
|
| | |
|
|
| | 05:SCAN HDFS [functional.alltypestiny]
|
|
| | partitions=1/4 size=115B
|
|
| |
|
|
| |--34:AGGREGATE
|
|
| | | group by: id, bool_col, tinyint_col, smallint_col, int_col, bigint_col, float_col, double_col, date_string_col, string_col, timestamp_col, year, month
|
|
| | |
|
|
| | 31:MERGE
|
|
| | |
|
|
| | 03:SCAN HDFS [functional.alltypestiny]
|
|
| | partitions=1/4 size=115B
|
|
| |
|
|
| |--33:AGGREGATE
|
|
| | | group by: id, bool_col, tinyint_col, smallint_col, int_col, bigint_col, float_col, double_col, date_string_col, string_col, timestamp_col, year, month
|
|
| | |
|
|
| | 30:MERGE
|
|
| | |
|
|
| | 02:SCAN HDFS [functional.alltypestiny]
|
|
| | partitions=1/4 size=115B
|
|
| |
|
|
| 08:AGGREGATE
|
|
| | group by: id, bool_col, tinyint_col, smallint_col, int_col, bigint_col, float_col, double_col, date_string_col, string_col, timestamp_col, year, month
|
|
| |
|
|
| 29:MERGE
|
|
| |
|
|
| 01:SCAN HDFS [functional.alltypestiny]
|
|
| partitions=1/4 size=115B
|
|
|
|
|
|--41:MERGE
|
|
| |
|
|
| 21:TOP-N [LIMIT=3]
|
|
| | order by: tinyint_col ASC
|
|
| |
|
|
| 20:EXCHANGE [PARTITION=UNPARTITIONED]
|
|
| |
|
|
| |--19:TOP-N [LIMIT=3]
|
|
| | | order by: tinyint_col ASC
|
|
| | |
|
|
| | 18:MERGE
|
|
| | |
|
|
| | 14:SCAN HDFS [functional.alltypestiny]
|
|
| | partitions=0/4 size=0B
|
|
| |
|
|
| 15:TOP-N [LIMIT=3]
|
|
| | order by: tinyint_col ASC
|
|
| |
|
|
| 17:MERGE
|
|
| |
|
|
| 13:SCAN HDFS [functional.alltypestiny]
|
|
| partitions=1/4 size=115B
|
|
|
|
|
|--40:MERGE
|
|
| |
|
|
| 11:SCAN HDFS [functional.alltypestiny]
|
|
| partitions=1/4 size=115B
|
|
|
|
|
39:MERGE
|
|
|
|
|
10:SCAN HDFS [functional.alltypestiny]
|
|
partitions=1/4 size=115B
|
|
====
|
|
// UNION ALL in subquery
|
|
select x.* from
|
|
(select * from functional.alltypestiny where year=2009 and month=1
|
|
union all
|
|
select * from functional.alltypestiny where year=2009 and month=1) x
|
|
union all
|
|
(select * from functional.alltypestiny where year=2009 and month=2)
|
|
order by 3 limit 5
|
|
---- PLAN
|
|
05:TOP-N [LIMIT=5]
|
|
| order by: tinyint_col ASC
|
|
|
|
|
00:MERGE
|
|
|
|
|
|--04:SCAN HDFS [functional.alltypestiny]
|
|
| partitions=1/4 size=115B
|
|
|
|
|
01:MERGE
|
|
|
|
|
|--03:SCAN HDFS [functional.alltypestiny]
|
|
| partitions=1/4 size=115B
|
|
|
|
|
02:SCAN HDFS [functional.alltypestiny]
|
|
partitions=1/4 size=115B
|
|
---- SCANRANGELOCATIONS
|
|
NODE 2:
|
|
HDFS SPLIT hdfs://localhost:20500/test-warehouse/alltypestiny/year=2009/month=1/090101.txt 0:115
|
|
NODE 3:
|
|
HDFS SPLIT hdfs://localhost:20500/test-warehouse/alltypestiny/year=2009/month=1/090101.txt 0:115
|
|
NODE 4:
|
|
HDFS SPLIT hdfs://localhost:20500/test-warehouse/alltypestiny/year=2009/month=2/090201.txt 0:115
|
|
---- DISTRIBUTEDPLAN
|
|
14:TOP-N [LIMIT=5]
|
|
| order by: tinyint_col ASC
|
|
|
|
|
13:EXCHANGE [PARTITION=UNPARTITIONED]
|
|
|
|
|
|--12:TOP-N [LIMIT=5]
|
|
| | order by: tinyint_col ASC
|
|
| |
|
|
| 11:MERGE
|
|
| |
|
|
| 04:SCAN HDFS [functional.alltypestiny]
|
|
| partitions=1/4 size=115B
|
|
|
|
|
05:TOP-N [LIMIT=5]
|
|
| order by: tinyint_col ASC
|
|
|
|
|
10:MERGE
|
|
|
|
|
06:EXCHANGE [PARTITION=UNPARTITIONED]
|
|
|
|
|
|--08:MERGE
|
|
| |
|
|
| 03:SCAN HDFS [functional.alltypestiny]
|
|
| partitions=1/4 size=115B
|
|
|
|
|
07:MERGE
|
|
|
|
|
02:SCAN HDFS [functional.alltypestiny]
|
|
partitions=1/4 size=115B
|
|
====
|
|
// UNION DISTINCT in subquery
|
|
select x.* from
|
|
(select * from functional.alltypestiny where year=2009 and month=1
|
|
union distinct
|
|
select * from functional.alltypestiny where year=2009 and month=1) x
|
|
union distinct
|
|
(select * from functional.alltypestiny where year=2009 and month=2)
|
|
order by 3 limit 3
|
|
---- PLAN
|
|
07:TOP-N [LIMIT=3]
|
|
| order by: tinyint_col ASC
|
|
|
|
|
06:AGGREGATE [FINALIZE]
|
|
| group by: id, bool_col, tinyint_col, smallint_col, int_col, bigint_col, float_col, double_col, date_string_col, string_col, timestamp_col, year, month
|
|
|
|
|
00:MERGE
|
|
|
|
|
|--05:SCAN HDFS [functional.alltypestiny]
|
|
| partitions=1/4 size=115B
|
|
|
|
|
04:AGGREGATE [FINALIZE]
|
|
| group by: id, bool_col, tinyint_col, smallint_col, int_col, bigint_col, float_col, double_col, date_string_col, string_col, timestamp_col, year, month
|
|
|
|
|
01:MERGE
|
|
|
|
|
|--03:SCAN HDFS [functional.alltypestiny]
|
|
| partitions=1/4 size=115B
|
|
|
|
|
02:SCAN HDFS [functional.alltypestiny]
|
|
partitions=1/4 size=115B
|
|
---- SCANRANGELOCATIONS
|
|
NODE 2:
|
|
HDFS SPLIT hdfs://localhost:20500/test-warehouse/alltypestiny/year=2009/month=1/090101.txt 0:115
|
|
NODE 3:
|
|
HDFS SPLIT hdfs://localhost:20500/test-warehouse/alltypestiny/year=2009/month=1/090101.txt 0:115
|
|
NODE 5:
|
|
HDFS SPLIT hdfs://localhost:20500/test-warehouse/alltypestiny/year=2009/month=2/090201.txt 0:115
|
|
---- DISTRIBUTEDPLAN
|
|
21:TOP-N [LIMIT=3]
|
|
| order by: tinyint_col ASC
|
|
|
|
|
20:EXCHANGE [PARTITION=UNPARTITIONED]
|
|
|
|
|
07:TOP-N [LIMIT=3]
|
|
| order by: tinyint_col ASC
|
|
|
|
|
19:AGGREGATE [MERGE FINALIZE]
|
|
| group by: id, bool_col, tinyint_col, smallint_col, int_col, bigint_col, float_col, double_col, date_string_col, string_col, timestamp_col, year, month
|
|
|
|
|
18:EXCHANGE [PARTITION=HASH(id,bool_col,tinyint_col,smallint_col,int_col,bigint_col,float_col,double_col,date_string_col,string_col,timestamp_col,year,month)]
|
|
|
|
|
|--17:AGGREGATE
|
|
| | group by: id, bool_col, tinyint_col, smallint_col, int_col, bigint_col, float_col, double_col, date_string_col, string_col, timestamp_col, year, month
|
|
| |
|
|
| 16:MERGE
|
|
| |
|
|
| 05:SCAN HDFS [functional.alltypestiny]
|
|
| partitions=1/4 size=115B
|
|
|
|
|
06:AGGREGATE
|
|
| group by: id, bool_col, tinyint_col, smallint_col, int_col, bigint_col, float_col, double_col, date_string_col, string_col, timestamp_col, year, month
|
|
|
|
|
15:MERGE
|
|
|
|
|
13:AGGREGATE [MERGE FINALIZE]
|
|
| group by: id, bool_col, tinyint_col, smallint_col, int_col, bigint_col, float_col, double_col, date_string_col, string_col, timestamp_col, year, month
|
|
|
|
|
12:EXCHANGE [PARTITION=HASH(id,bool_col,tinyint_col,smallint_col,int_col,bigint_col,float_col,double_col,date_string_col,string_col,timestamp_col,year,month)]
|
|
|
|
|
|--11:AGGREGATE
|
|
| | group by: id, bool_col, tinyint_col, smallint_col, int_col, bigint_col, float_col, double_col, date_string_col, string_col, timestamp_col, year, month
|
|
| |
|
|
| 10:MERGE
|
|
| |
|
|
| 03:SCAN HDFS [functional.alltypestiny]
|
|
| partitions=1/4 size=115B
|
|
|
|
|
04:AGGREGATE
|
|
| group by: id, bool_col, tinyint_col, smallint_col, int_col, bigint_col, float_col, double_col, date_string_col, string_col, timestamp_col, year, month
|
|
|
|
|
09:MERGE
|
|
|
|
|
02:SCAN HDFS [functional.alltypestiny]
|
|
partitions=1/4 size=115B
|
|
====
|
|
// UNION ALL in subquery with a WHERE condition in the outer select.
|
|
select x.* from
|
|
(select int_col, bool_col, count(*) as count_col
|
|
from functional.alltypestiny where year=2009 and month=1 group by 1, 2
|
|
union all
|
|
select int_col, bool_col, count(*) as count_col
|
|
from functional.alltypestiny where year=2009 and month=1 group by 1, 2) x
|
|
where x.int_col < 5 and x.bool_col = false
|
|
---- PLAN
|
|
00:MERGE
|
|
|
|
|
|--04:AGGREGATE [FINALIZE]
|
|
| | output: count(*)
|
|
| | group by: int_col, bool_col
|
|
| |
|
|
| 03:SCAN HDFS [functional.alltypestiny]
|
|
| partitions=1/4 size=115B
|
|
| predicates: functional.alltypestiny.int_col < 5, functional.alltypestiny.bool_col = FALSE
|
|
|
|
|
02:AGGREGATE [FINALIZE]
|
|
| output: count(*)
|
|
| group by: int_col, bool_col
|
|
|
|
|
01:SCAN HDFS [functional.alltypestiny]
|
|
partitions=1/4 size=115B
|
|
predicates: functional.alltypestiny.int_col < 5, functional.alltypestiny.bool_col = FALSE
|
|
---- SCANRANGELOCATIONS
|
|
NODE 1:
|
|
HDFS SPLIT hdfs://localhost:20500/test-warehouse/alltypestiny/year=2009/month=1/090101.txt 0:115
|
|
NODE 3:
|
|
HDFS SPLIT hdfs://localhost:20500/test-warehouse/alltypestiny/year=2009/month=1/090101.txt 0:115
|
|
---- DISTRIBUTEDPLAN
|
|
09:EXCHANGE [PARTITION=UNPARTITIONED]
|
|
|
|
|
|--11:MERGE
|
|
| |
|
|
| 08:AGGREGATE [MERGE FINALIZE]
|
|
| | output: sum(count(*))
|
|
| | group by: int_col, bool_col
|
|
| |
|
|
| 07:EXCHANGE [PARTITION=HASH(int_col,bool_col)]
|
|
| |
|
|
| 04:AGGREGATE
|
|
| | output: count(*)
|
|
| | group by: int_col, bool_col
|
|
| |
|
|
| 03:SCAN HDFS [functional.alltypestiny]
|
|
| partitions=1/4 size=115B
|
|
| predicates: functional.alltypestiny.int_col < 5, functional.alltypestiny.bool_col = FALSE
|
|
|
|
|
10:MERGE
|
|
|
|
|
06:AGGREGATE [MERGE FINALIZE]
|
|
| output: sum(count(*))
|
|
| group by: int_col, bool_col
|
|
|
|
|
05:EXCHANGE [PARTITION=HASH(int_col,bool_col)]
|
|
|
|
|
02:AGGREGATE
|
|
| output: count(*)
|
|
| group by: int_col, bool_col
|
|
|
|
|
01:SCAN HDFS [functional.alltypestiny]
|
|
partitions=1/4 size=115B
|
|
predicates: functional.alltypestiny.int_col < 5, functional.alltypestiny.bool_col = FALSE
|
|
====
|
|
// UNION ALL with only constant selects
|
|
select 1, 'a', NULL, 10.f
|
|
union all
|
|
select 2, 'b', NULL, 20.f
|
|
union all
|
|
select 3, 'c', NULL, 30.f
|
|
---- PLAN
|
|
00:MERGE
|
|
constant-selects=3
|
|
---- DISTRIBUTEDPLAN
|
|
00:MERGE
|
|
constant-selects=3
|
|
====
|
|
// UNION DISTINCT with only constant selects
|
|
select 1, 'a', NULL, 10.0f
|
|
union distinct
|
|
select 2, 'b', NULL, 20.0f
|
|
union distinct
|
|
select 3, 'c', NULL, 30.0f
|
|
---- PLAN
|
|
01:AGGREGATE [FINALIZE]
|
|
| group by: 1, 'a', null, f
|
|
|
|
|
00:MERGE
|
|
constant-selects=3
|
|
---- DISTRIBUTEDPLAN
|
|
01:AGGREGATE [FINALIZE]
|
|
| group by: 1, 'a', null, f
|
|
|
|
|
00:MERGE
|
|
constant-selects=3
|
|
====
|
|
// UNION ALL/DISTINCT with mixed constant selects and non-constant selects
|
|
select 1, 'a', NULL, 10.f
|
|
union all
|
|
select int_col, string_col, bool_col, float_col from functional.alltypestiny
|
|
union distinct
|
|
select 3, 'c', NULL, 30.f
|
|
union all
|
|
select int_col, string_col, bool_col, float_col from functional.alltypestiny
|
|
---- PLAN
|
|
03:MERGE
|
|
|
|
|
|--02:AGGREGATE [FINALIZE]
|
|
| | group by: 1, 'a', null, f
|
|
| |
|
|
| 00:MERGE
|
|
| | constant-selects=2
|
|
| |
|
|
| 01:SCAN HDFS [functional.alltypestiny]
|
|
| partitions=4/4 size=460B
|
|
|
|
|
04:SCAN HDFS [functional.alltypestiny]
|
|
partitions=4/4 size=460B
|
|
---- DISTRIBUTEDPLAN
|
|
11:EXCHANGE [PARTITION=UNPARTITIONED]
|
|
|
|
|
|--13:MERGE
|
|
| |
|
|
| 10:AGGREGATE [MERGE FINALIZE]
|
|
| | group by: 1, 'a', null, f
|
|
| |
|
|
| 09:EXCHANGE [PARTITION=HASH(1,'a',null,f)]
|
|
| |
|
|
| |--08:AGGREGATE
|
|
| | | group by: 1, 'a', null, f
|
|
| | |
|
|
| | 07:MERGE
|
|
| | constant-selects=2
|
|
| |
|
|
| 02:AGGREGATE
|
|
| | group by: 1, 'a', null, f
|
|
| |
|
|
| 06:MERGE
|
|
| |
|
|
| 01:SCAN HDFS [functional.alltypestiny]
|
|
| partitions=4/4 size=460B
|
|
|
|
|
12:MERGE
|
|
|
|
|
04:SCAN HDFS [functional.alltypestiny]
|
|
partitions=4/4 size=460B
|
|
====
|
|
// UNION ALL/DISTINCT with mixed constant selects and non-constant selects and nested unions
|
|
(select 500
|
|
union all
|
|
(select int_col from functional.alltypestiny where year=2009 and month=2
|
|
order by 1 limit 3
|
|
union all
|
|
select 500)
|
|
)
|
|
union distinct
|
|
select int_col from functional.alltypestiny where year=2009 and month=1
|
|
union all
|
|
select 503
|
|
---- PLAN
|
|
05:MERGE
|
|
| constant-selects=1
|
|
|
|
|
04:AGGREGATE [FINALIZE]
|
|
| group by: 500
|
|
|
|
|
00:MERGE
|
|
| constant-selects=2
|
|
|
|
|
|--03:SCAN HDFS [functional.alltypestiny]
|
|
| partitions=1/4 size=115B
|
|
|
|
|
02:TOP-N [LIMIT=3]
|
|
| order by: int_col ASC
|
|
|
|
|
01:SCAN HDFS [functional.alltypestiny]
|
|
partitions=1/4 size=115B
|
|
---- DISTRIBUTEDPLAN
|
|
16:EXCHANGE [PARTITION=UNPARTITIONED]
|
|
|
|
|
|--18:MERGE
|
|
| constant-selects=1
|
|
|
|
|
17:MERGE
|
|
|
|
|
15:AGGREGATE [MERGE FINALIZE]
|
|
| group by: 500
|
|
|
|
|
14:EXCHANGE [PARTITION=HASH(500)]
|
|
|
|
|
|--13:AGGREGATE
|
|
| | group by: 500
|
|
| |
|
|
| 11:MERGE
|
|
| constant-selects=2
|
|
|
|
|
|--12:AGGREGATE
|
|
| | group by: 500
|
|
| |
|
|
| 10:MERGE
|
|
| |
|
|
| 03:SCAN HDFS [functional.alltypestiny]
|
|
| partitions=1/4 size=115B
|
|
|
|
|
04:AGGREGATE
|
|
| group by: 500
|
|
|
|
|
09:MERGE
|
|
|
|
|
07:TOP-N [LIMIT=3]
|
|
| order by: int_col ASC
|
|
|
|
|
06:EXCHANGE [PARTITION=UNPARTITIONED]
|
|
|
|
|
02:TOP-N [LIMIT=3]
|
|
| order by: int_col ASC
|
|
|
|
|
01:SCAN HDFS [functional.alltypestiny]
|
|
partitions=1/4 size=115B
|
|
====
|
|
// UNION ALL with only values statements
|
|
values(1, 'a', NULL, 10.f)
|
|
union all
|
|
values(2, 'b', NULL, 20.f)
|
|
union all
|
|
values(3, 'c', NULL, 30.f)
|
|
---- PLAN
|
|
00:MERGE
|
|
constant-selects=3
|
|
---- DISTRIBUTEDPLAN
|
|
00:MERGE
|
|
constant-selects=3
|
|
====
|
|
// UNION DISTINCT with only values statements
|
|
values(1, 'a', NULL, 10.f)
|
|
union distinct
|
|
values(2, 'b', NULL, 20.f)
|
|
union distinct
|
|
values(3, 'c', NULL, 30.f)
|
|
---- PLAN
|
|
01:AGGREGATE [FINALIZE]
|
|
| group by: 1, 'a', null, f
|
|
|
|
|
00:MERGE
|
|
constant-selects=3
|
|
---- DISTRIBUTEDPLAN
|
|
01:AGGREGATE [FINALIZE]
|
|
| group by: 1, 'a', null, f
|
|
|
|
|
00:MERGE
|
|
constant-selects=3
|
|
====
|
|
// UNION ALL/DISTINCT with mixed values statements and non-constant selects
|
|
values(1, 'a', NULL, 10.f)
|
|
union all
|
|
select int_col, string_col, bool_col, float_col from functional.alltypestiny
|
|
union distinct
|
|
values(3, 'c', NULL, 30.f)
|
|
union all
|
|
select int_col, string_col, bool_col, float_col from functional.alltypessmall
|
|
---- PLAN
|
|
03:MERGE
|
|
|
|
|
|--02:AGGREGATE [FINALIZE]
|
|
| | group by: 1, 'a', null, f
|
|
| |
|
|
| 00:MERGE
|
|
| | constant-selects=2
|
|
| |
|
|
| 01:SCAN HDFS [functional.alltypestiny]
|
|
| partitions=4/4 size=460B
|
|
|
|
|
04:SCAN HDFS [functional.alltypessmall]
|
|
partitions=4/4 size=6.32KB
|
|
---- DISTRIBUTEDPLAN
|
|
11:EXCHANGE [PARTITION=UNPARTITIONED]
|
|
|
|
|
|--13:MERGE
|
|
| |
|
|
| 10:AGGREGATE [MERGE FINALIZE]
|
|
| | group by: 1, 'a', null, f
|
|
| |
|
|
| 09:EXCHANGE [PARTITION=HASH(1,'a',null,f)]
|
|
| |
|
|
| |--08:AGGREGATE
|
|
| | | group by: 1, 'a', null, f
|
|
| | |
|
|
| | 07:MERGE
|
|
| | constant-selects=2
|
|
| |
|
|
| 02:AGGREGATE
|
|
| | group by: 1, 'a', null, f
|
|
| |
|
|
| 06:MERGE
|
|
| |
|
|
| 01:SCAN HDFS [functional.alltypestiny]
|
|
| partitions=4/4 size=460B
|
|
|
|
|
12:MERGE
|
|
|
|
|
04:SCAN HDFS [functional.alltypessmall]
|
|
partitions=4/4 size=6.32KB
|
|
====
|
|
# all union output slots are being materialized even though none is referenced by
|
|
# the enclosing scope
|
|
select count(*) from (
|
|
select id, bool_col, tinyint_col, smallint_col, int_col, bigint_col, float_col,
|
|
double_col, date_string_col, string_col, timestamp_col, year, month
|
|
from functional.alltypes
|
|
union distinct
|
|
select 0,true,0,0,0,0,cast(0 as float),0,'01/01/09','0',
|
|
cast('2009-01-01 00:00:00' as timestamp),2009,1
|
|
union distinct
|
|
select id, bool_col, tinyint_col, smallint_col, int_col, bigint_col, float_col,
|
|
double_col, date_string_col, string_col, timestamp_col, year, month
|
|
from functional.alltypes
|
|
union distinct
|
|
select 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),2009,1
|
|
union distinct
|
|
select 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),2009,1
|
|
) x
|
|
---- PLAN
|
|
04:AGGREGATE [FINALIZE]
|
|
| output: count(*)
|
|
|
|
|
03:AGGREGATE [FINALIZE]
|
|
| group by: id, bool_col, tinyint_col, smallint_col, int_col, bigint_col, float_col, double_col, date_string_col, string_col, timestamp_col, year, month
|
|
|
|
|
00:MERGE
|
|
| constant-selects=3
|
|
|
|
|
|--02:SCAN HDFS [functional.alltypes]
|
|
| partitions=24/24 size=478.45KB
|
|
|
|
|
01:SCAN HDFS [functional.alltypes]
|
|
partitions=24/24 size=478.45KB
|
|
---- DISTRIBUTEDPLAN
|
|
14:AGGREGATE [MERGE FINALIZE]
|
|
| output: sum(count(*))
|
|
|
|
|
13:EXCHANGE [PARTITION=UNPARTITIONED]
|
|
|
|
|
04:AGGREGATE
|
|
| output: count(*)
|
|
|
|
|
12:AGGREGATE [MERGE FINALIZE]
|
|
| group by: id, bool_col, tinyint_col, smallint_col, int_col, bigint_col, float_col, double_col, date_string_col, string_col, timestamp_col, year, month
|
|
|
|
|
11:EXCHANGE [PARTITION=HASH(id,bool_col,tinyint_col,smallint_col,int_col,bigint_col,float_col,double_col,date_string_col,string_col,timestamp_col,year,month)]
|
|
|
|
|
|--10:AGGREGATE
|
|
| | group by: id, bool_col, tinyint_col, smallint_col, int_col, bigint_col, float_col, double_col, date_string_col, string_col, timestamp_col, year, month
|
|
| |
|
|
| 08:MERGE
|
|
| constant-selects=3
|
|
|
|
|
|--09:AGGREGATE
|
|
| | group by: id, bool_col, tinyint_col, smallint_col, int_col, bigint_col, float_col, double_col, date_string_col, string_col, timestamp_col, year, month
|
|
| |
|
|
| 07:MERGE
|
|
| |
|
|
| 02:SCAN HDFS [functional.alltypes]
|
|
| partitions=24/24 size=478.45KB
|
|
|
|
|
03:AGGREGATE
|
|
| group by: id, bool_col, tinyint_col, smallint_col, int_col, bigint_col, float_col, double_col, date_string_col, string_col, timestamp_col, year, month
|
|
|
|
|
06:MERGE
|
|
|
|
|
01:SCAN HDFS [functional.alltypes]
|
|
partitions=24/24 size=478.45KB
|
|
====
|
|
# UNION ALL in subquery with a WHERE condition in the outer select;
|
|
# Where clause conjuncts are used as scan predicates and for partition pruning.
|
|
select x.int_col, x.bool_col, x.month from
|
|
(select * from functional.alltypestiny where year=2009
|
|
union all
|
|
select * from functional.alltypestiny where year=2009) x
|
|
where x.int_col < 5 and x.bool_col = false and x.month = 1
|
|
---- PLAN
|
|
00:MERGE
|
|
|
|
|
|--02:SCAN HDFS [functional.alltypestiny]
|
|
| partitions=1/4 size=115B
|
|
| predicates: functional.alltypestiny.int_col < 5, functional.alltypestiny.bool_col = FALSE
|
|
|
|
|
01:SCAN HDFS [functional.alltypestiny]
|
|
partitions=1/4 size=115B
|
|
predicates: functional.alltypestiny.int_col < 5, functional.alltypestiny.bool_col = FALSE
|
|
---- DISTRIBUTEDPLAN
|
|
03:EXCHANGE [PARTITION=UNPARTITIONED]
|
|
|
|
|
|--05:MERGE
|
|
| |
|
|
| 02:SCAN HDFS [functional.alltypestiny]
|
|
| partitions=1/4 size=115B
|
|
| predicates: functional.alltypestiny.int_col < 5, functional.alltypestiny.bool_col = FALSE
|
|
|
|
|
04:MERGE
|
|
|
|
|
01:SCAN HDFS [functional.alltypestiny]
|
|
partitions=1/4 size=115B
|
|
predicates: functional.alltypestiny.int_col < 5, functional.alltypestiny.bool_col = FALSE
|
|
====
|
|
# Regression test for IMPALA-888. Tests proper materialization of slots in
|
|
# the presence of conjuncts that become constant for union operands.
|
|
select 1 from
|
|
(select 1 a, 2 b, int_col c, bigint_col d from functional.alltypestiny
|
|
union all
|
|
select tinyint_col, int_col, smallint_col, bigint_col from functional.alltypes
|
|
union all
|
|
select 1, tinyint_col, 3, bigint_col from functional.alltypessmall) t
|
|
where a + b < 100 and c > 20 and d > 50
|
|
---- PLAN
|
|
00:MERGE
|
|
|
|
|
|--02:SCAN HDFS [functional.alltypes]
|
|
| partitions=24/24 size=478.45KB
|
|
| predicates: functional.alltypes.tinyint_col + functional.alltypes.int_col < 100, functional.alltypes.smallint_col > 20, functional.alltypes.bigint_col > 50
|
|
|
|
|
01:SCAN HDFS [functional.alltypestiny]
|
|
partitions=4/4 size=460B
|
|
predicates: functional.alltypestiny.int_col > 20, functional.alltypestiny.bigint_col > 50
|
|
====
|
|
# Test union where all operands are dropped because of constant conjuncts.
|
|
select * from
|
|
(select 1 a, 2 b
|
|
union all
|
|
select 3, 4
|
|
union all
|
|
select 10, 20) t
|
|
where a > b
|
|
---- PLAN
|
|
00:MERGE
|
|
---- DISTRIBUTEDPLAN
|
|
00:MERGE
|
|
====
|