mirror of
https://github.com/apache/impala.git
synced 2026-01-08 03:02:48 -05:00
The plan-root fragment instance that runs on the coordinator should be handled like all others: started via RPC and run asynchronously. Without this, the fragment requires special-case code throughout the coordinator, and does not show up in system metrics etc. This patch adds a new sink type, PlanRootSink, to the root fragment instance so that the coordinator can pull row batches that are pushed by the root instance. The coordinator signals completion to the fragment instance via closing the consumer side of the sink, whereupon the instance is free to complete. Since the root instance now runs asynchronously wrt to the coordinator, we add several coordination methods to allow the coordinator to wait for a point in the instance's execution to be hit - e.g. to wait until the instance has been opened. Done in this patch: * Add PlanRootSink * Add coordination to PFE to allow coordinator to observe lifecycle * Make FragmentMgr a singleton * Removed dead code from Coordinator::Wait() and elsewhere. * Moved result output exprs out of QES and into PlanRootSink. * Remove special-case limit-based teardown of coordinator fragment, and supporting functions in PlanFragmentExecutor. * Simplified lifecycle of PlanFragmentExecutor by separating Open() into Open() and Exec(), the latter of which drives the sink by reading rows from the plan tree. * Add child profile to PlanFragmentExecutor to measure time spent in each lifecycle phase. * Removed dependency between InitExecProfiles() and starting root fragment. * Removed mostly dead-code handling of LIMIT 0 queries. * Ensured that SET returns a result set in all cases. * Fix test_get_log() HS2 test. Errors are only guaranteed to be visible after fetch calls return EOS, but test was assuming this would happen after first fetch. Change-Id: Ibb0064ec2f085fa3a5598ea80894fb489a01e4df Reviewed-on: http://gerrit.cloudera.org:8080/4402 Tested-by: Internal Jenkins Reviewed-by: Henry Robinson <henry@cloudera.com>
1990 lines
51 KiB
Plaintext
1990 lines
51 KiB
Plaintext
# Scan of a nested array of scalars.
|
|
select * from functional.allcomplextypes.int_array_col
|
|
where item > 10
|
|
---- PLAN
|
|
PLAN-ROOT SINK
|
|
|
|
|
00:SCAN HDFS [functional.allcomplextypes.int_array_col]
|
|
partitions=0/0 files=0 size=0B
|
|
predicates: item > 10
|
|
====
|
|
# Scan of a nested map with scalar key and value.
|
|
select * from functional.allcomplextypes.int_map_col
|
|
where key = 'test' and value < 10
|
|
---- PLAN
|
|
PLAN-ROOT SINK
|
|
|
|
|
00:SCAN HDFS [functional.allcomplextypes.int_map_col]
|
|
partitions=0/0 files=0 size=0B
|
|
predicates: value < 10, key = 'test'
|
|
====
|
|
# Scan of a deeply nested collection.
|
|
select count(f21) from functional.allcomplextypes.complex_nested_struct_col.f2.f12
|
|
where key = 'test'
|
|
---- PLAN
|
|
PLAN-ROOT SINK
|
|
|
|
|
01:AGGREGATE [FINALIZE]
|
|
| output: count(f21)
|
|
|
|
|
00:SCAN HDFS [functional.allcomplextypes.complex_nested_struct_col.f2.f12]
|
|
partitions=0/0 files=0 size=0B
|
|
predicates: key = 'test'
|
|
====
|
|
# Join on two nested collections with structs.
|
|
select count(*) from
|
|
functional.allcomplextypes.struct_array_col a
|
|
inner join functional.allcomplextypes.struct_map_col b
|
|
on (a.f1 = b.f1)
|
|
where a.f2 = 'test_a' and b.f2 = 'test_b'
|
|
---- PLAN
|
|
PLAN-ROOT SINK
|
|
|
|
|
03:AGGREGATE [FINALIZE]
|
|
| output: count(*)
|
|
|
|
|
02:HASH JOIN [INNER JOIN]
|
|
| hash predicates: a.f1 = b.f1
|
|
| runtime filters: RF000 <- b.f1
|
|
|
|
|
|--01:SCAN HDFS [functional.allcomplextypes.struct_map_col b]
|
|
| partitions=0/0 files=0 size=0B
|
|
| predicates: b.f2 = 'test_b'
|
|
|
|
|
00:SCAN HDFS [functional.allcomplextypes.struct_array_col a]
|
|
partitions=0/0 files=0 size=0B
|
|
predicates: a.f2 = 'test_a'
|
|
runtime filters: RF000 -> a.f1
|
|
====
|
|
# Test assignment of equi-join conjuncts and enforcement of
|
|
# slot equivalences in a bushy join.
|
|
select 1 from
|
|
tpch_nested_parquet.region r,
|
|
r.r_nations n,
|
|
tpch_nested_parquet.customer c,
|
|
tpch_nested_parquet.supplier s
|
|
where c_nationkey = n_nationkey and s_nationkey = n_nationkey
|
|
and c_comment = s_comment and n_comment = s_comment
|
|
---- PLAN
|
|
PLAN-ROOT SINK
|
|
|
|
|
08:HASH JOIN [INNER JOIN]
|
|
| hash predicates: c_nationkey = n_nationkey, s_comment = n_comment
|
|
| runtime filters: RF000 <- n_nationkey, RF001 <- n_comment
|
|
|
|
|
|--01:SUBPLAN
|
|
| |
|
|
| |--04:NESTED LOOP JOIN [CROSS JOIN]
|
|
| | |
|
|
| | |--02:SINGULAR ROW SRC
|
|
| | |
|
|
| | 03:UNNEST [r.r_nations n]
|
|
| |
|
|
| 00:SCAN HDFS [tpch_nested_parquet.region r]
|
|
| partitions=1/1 files=1 size=4.18KB
|
|
| predicates: !empty(r.r_nations)
|
|
|
|
|
07:HASH JOIN [INNER JOIN]
|
|
| hash predicates: c.c_nationkey = s.s_nationkey, c_comment = s_comment
|
|
| runtime filters: RF002 <- s.s_nationkey, RF003 <- s_comment
|
|
|
|
|
|--06:SCAN HDFS [tpch_nested_parquet.supplier s]
|
|
| partitions=1/1 files=1 size=111.08MB
|
|
| runtime filters: RF000 -> s.s_nationkey, RF001 -> s_comment
|
|
|
|
|
05:SCAN HDFS [tpch_nested_parquet.customer c]
|
|
partitions=1/1 files=4 size=577.87MB
|
|
runtime filters: RF000 -> c_nationkey, RF001 -> c.c_comment, RF002 -> c.c_nationkey, RF003 -> c_comment
|
|
====
|
|
# Test subplans: Cross join of parent and relative ref.
|
|
select a.id, b.item from functional.allcomplextypes a cross join a.int_array_col b
|
|
where a.id < 10 and b.item % 2 = 0
|
|
---- PLAN
|
|
PLAN-ROOT SINK
|
|
|
|
|
01:SUBPLAN
|
|
|
|
|
|--04:NESTED LOOP JOIN [CROSS JOIN]
|
|
| |
|
|
| |--02:SINGULAR ROW SRC
|
|
| |
|
|
| 03:UNNEST [a.int_array_col b]
|
|
|
|
|
00:SCAN HDFS [functional.allcomplextypes a]
|
|
partitions=0/0 files=0 size=0B
|
|
predicates: a.id < 10, !empty(a.int_array_col)
|
|
predicates on b: b.item % 2 = 0
|
|
====
|
|
# Test subplans: Left semi join of parent and relative ref without On-clause.
|
|
select a.id from functional.allcomplextypes a left semi join a.int_array_col b
|
|
where a.id < 10
|
|
---- PLAN
|
|
PLAN-ROOT SINK
|
|
|
|
|
01:SUBPLAN
|
|
|
|
|
|--04:NESTED LOOP JOIN [RIGHT SEMI JOIN]
|
|
| |
|
|
| |--02:SINGULAR ROW SRC
|
|
| |
|
|
| 03:UNNEST [a.int_array_col b]
|
|
|
|
|
00:SCAN HDFS [functional.allcomplextypes a]
|
|
partitions=0/0 files=0 size=0B
|
|
predicates: a.id < 10, !empty(a.int_array_col)
|
|
====
|
|
# Test subplans: Right semi join of parent and relative ref without On-clause.
|
|
select b.item from functional.allcomplextypes a right semi join a.int_array_col b
|
|
where b.item % 2 = 0
|
|
---- PLAN
|
|
PLAN-ROOT SINK
|
|
|
|
|
01:SUBPLAN
|
|
|
|
|
|--04:NESTED LOOP JOIN [LEFT SEMI JOIN]
|
|
| |
|
|
| |--02:SINGULAR ROW SRC
|
|
| |
|
|
| 03:UNNEST [a.int_array_col b]
|
|
|
|
|
00:SCAN HDFS [functional.allcomplextypes a]
|
|
partitions=0/0 files=0 size=0B
|
|
predicates: !empty(a.int_array_col)
|
|
predicates on b: b.item % 2 = 0
|
|
====
|
|
# Test subplans: Left anti join of parent and relative ref without On-clause.
|
|
select a.id from functional.allcomplextypes a left anti join a.int_array_col b
|
|
where a.id < 10
|
|
---- PLAN
|
|
PLAN-ROOT SINK
|
|
|
|
|
01:SUBPLAN
|
|
|
|
|
|--04:NESTED LOOP JOIN [RIGHT ANTI JOIN]
|
|
| |
|
|
| |--02:SINGULAR ROW SRC
|
|
| |
|
|
| 03:UNNEST [a.int_array_col b]
|
|
|
|
|
00:SCAN HDFS [functional.allcomplextypes a]
|
|
partitions=0/0 files=0 size=0B
|
|
predicates: a.id < 10
|
|
====
|
|
# Test subplans: Same as above but with an equivalent inline view on the rhs.
|
|
select a.id from functional.allcomplextypes a
|
|
left anti join (select * from a.int_array_col) v
|
|
where a.id < 10
|
|
---- PLAN
|
|
PLAN-ROOT SINK
|
|
|
|
|
01:SUBPLAN
|
|
|
|
|
|--04:NESTED LOOP JOIN [RIGHT ANTI JOIN]
|
|
| |
|
|
| |--02:SINGULAR ROW SRC
|
|
| |
|
|
| 03:UNNEST [a.int_array_col]
|
|
|
|
|
00:SCAN HDFS [functional.allcomplextypes a]
|
|
partitions=0/0 files=0 size=0B
|
|
predicates: a.id < 10
|
|
====
|
|
# Test subplans: Right anti join of parent and relative ref without On-clause.
|
|
select b.item from functional.allcomplextypes a right anti join a.int_array_col b
|
|
where b.item % 2 = 0
|
|
---- PLAN
|
|
PLAN-ROOT SINK
|
|
|
|
|
01:SUBPLAN
|
|
|
|
|
|--04:NESTED LOOP JOIN [LEFT ANTI JOIN]
|
|
| |
|
|
| |--02:SINGULAR ROW SRC
|
|
| |
|
|
| 03:UNNEST [a.int_array_col b]
|
|
|
|
|
00:SCAN HDFS [functional.allcomplextypes a]
|
|
partitions=0/0 files=0 size=0B
|
|
predicates on b: b.item % 2 = 0
|
|
====
|
|
# Test subplans: Left outer join of parent and relative ref without On-clause.
|
|
select a.id, b.item from functional.allcomplextypes a left outer join a.int_array_col b
|
|
where a.id < 10
|
|
---- PLAN
|
|
PLAN-ROOT SINK
|
|
|
|
|
01:SUBPLAN
|
|
|
|
|
|--04:NESTED LOOP JOIN [RIGHT OUTER JOIN]
|
|
| |
|
|
| |--02:SINGULAR ROW SRC
|
|
| |
|
|
| 03:UNNEST [a.int_array_col b]
|
|
|
|
|
00:SCAN HDFS [functional.allcomplextypes a]
|
|
partitions=0/0 files=0 size=0B
|
|
predicates: a.id < 10
|
|
====
|
|
# Test subplans: Same as above but with an equivalent inline view on the rhs.
|
|
select a.id, v.item from functional.allcomplextypes a
|
|
left outer join (select * from a.int_array_col) v
|
|
where a.id < 10
|
|
---- PLAN
|
|
PLAN-ROOT SINK
|
|
|
|
|
01:SUBPLAN
|
|
|
|
|
|--04:NESTED LOOP JOIN [RIGHT OUTER JOIN]
|
|
| |
|
|
| |--02:SINGULAR ROW SRC
|
|
| |
|
|
| 03:UNNEST [a.int_array_col]
|
|
|
|
|
00:SCAN HDFS [functional.allcomplextypes a]
|
|
partitions=0/0 files=0 size=0B
|
|
predicates: a.id < 10
|
|
====
|
|
# Test subplans: Right outer join of parent and relative ref without On-clause.
|
|
select a.id, b.item from functional.allcomplextypes a right outer join a.int_array_col b
|
|
where b.item % 2 = 0
|
|
---- PLAN
|
|
PLAN-ROOT SINK
|
|
|
|
|
01:SUBPLAN
|
|
|
|
|
|--04:NESTED LOOP JOIN [LEFT OUTER JOIN]
|
|
| |
|
|
| |--02:SINGULAR ROW SRC
|
|
| |
|
|
| 03:UNNEST [a.int_array_col b]
|
|
|
|
|
00:SCAN HDFS [functional.allcomplextypes a]
|
|
partitions=0/0 files=0 size=0B
|
|
predicates on b: b.item % 2 = 0
|
|
====
|
|
# Test subplans: Full outer join of parent and relative ref without On-clause.
|
|
select a.id, b.item from functional.allcomplextypes a full outer join a.int_array_col b
|
|
where b.item % 2 = 0 and a.id < 10
|
|
---- PLAN
|
|
PLAN-ROOT SINK
|
|
|
|
|
01:SUBPLAN
|
|
|
|
|
|--04:NESTED LOOP JOIN [FULL OUTER JOIN]
|
|
| | predicates: a.id < 10, b.item % 2 = 0
|
|
| |
|
|
| |--02:SINGULAR ROW SRC
|
|
| |
|
|
| 03:UNNEST [a.int_array_col b]
|
|
|
|
|
00:SCAN HDFS [functional.allcomplextypes a]
|
|
partitions=0/0 files=0 size=0B
|
|
predicates: a.id < 10
|
|
predicates on b: b.item % 2 = 0
|
|
====
|
|
# Test subplans: Non-equi inner join of parent and relative ref.
|
|
select a.id, b.item from functional.allcomplextypes a, a.int_array_col b
|
|
where a.id < 10 and b.item % 2 = 0 and a.id < b.item
|
|
---- PLAN
|
|
PLAN-ROOT SINK
|
|
|
|
|
01:SUBPLAN
|
|
|
|
|
|--04:NESTED LOOP JOIN [INNER JOIN]
|
|
| | predicates: a.id < b.item
|
|
| |
|
|
| |--02:SINGULAR ROW SRC
|
|
| |
|
|
| 03:UNNEST [a.int_array_col b]
|
|
|
|
|
00:SCAN HDFS [functional.allcomplextypes a]
|
|
partitions=0/0 files=0 size=0B
|
|
predicates: a.id < 10, !empty(a.int_array_col)
|
|
predicates on b: b.item % 2 = 0
|
|
====
|
|
# Test subplans: Non-equi left semi join of parent and relative ref.
|
|
select a.id from functional.allcomplextypes a
|
|
left semi join a.int_array_col b on (a.id < b.item and b.item % 2 = 0)
|
|
where a.id < 10
|
|
---- PLAN
|
|
PLAN-ROOT SINK
|
|
|
|
|
01:SUBPLAN
|
|
|
|
|
|--04:NESTED LOOP JOIN [RIGHT SEMI JOIN]
|
|
| | join predicates: a.id < b.item
|
|
| |
|
|
| |--02:SINGULAR ROW SRC
|
|
| |
|
|
| 03:UNNEST [a.int_array_col b]
|
|
|
|
|
00:SCAN HDFS [functional.allcomplextypes a]
|
|
partitions=0/0 files=0 size=0B
|
|
predicates: a.id < 10, !empty(a.int_array_col)
|
|
predicates on b: b.item % 2 = 0
|
|
====
|
|
# Test subplans: Non-equi right semi join of parent and relative ref.
|
|
select b.item from functional.allcomplextypes a
|
|
right semi join a.int_array_col b on (a.id < b.item and a.id < 10)
|
|
where b.item % 2 = 0
|
|
---- PLAN
|
|
PLAN-ROOT SINK
|
|
|
|
|
01:SUBPLAN
|
|
|
|
|
|--04:NESTED LOOP JOIN [LEFT SEMI JOIN]
|
|
| | join predicates: a.id < b.item
|
|
| |
|
|
| |--02:SINGULAR ROW SRC
|
|
| |
|
|
| 03:UNNEST [a.int_array_col b]
|
|
|
|
|
00:SCAN HDFS [functional.allcomplextypes a]
|
|
partitions=0/0 files=0 size=0B
|
|
predicates: a.id < 10, !empty(a.int_array_col)
|
|
predicates on b: b.item % 2 = 0
|
|
====
|
|
# Test subplans: Non-equi left anti join of parent and relative ref.
|
|
select a.id from functional.allcomplextypes a
|
|
left anti join a.int_array_col b on (a.id < b.item and b.item % 2 = 0)
|
|
where a.id < 10
|
|
---- PLAN
|
|
PLAN-ROOT SINK
|
|
|
|
|
01:SUBPLAN
|
|
|
|
|
|--04:NESTED LOOP JOIN [RIGHT ANTI JOIN]
|
|
| | join predicates: a.id < b.item
|
|
| |
|
|
| |--02:SINGULAR ROW SRC
|
|
| |
|
|
| 03:UNNEST [a.int_array_col b]
|
|
|
|
|
00:SCAN HDFS [functional.allcomplextypes a]
|
|
partitions=0/0 files=0 size=0B
|
|
predicates: a.id < 10
|
|
predicates on b: b.item % 2 = 0
|
|
====
|
|
# Test subplans: Non-equi right anti join of parent and relative ref.
|
|
select b.item from functional.allcomplextypes a
|
|
right anti join a.int_array_col b on (a.id < b.item and a.id < 10)
|
|
where b.item % 2 = 0
|
|
---- PLAN
|
|
PLAN-ROOT SINK
|
|
|
|
|
01:SUBPLAN
|
|
|
|
|
|--04:NESTED LOOP JOIN [LEFT ANTI JOIN]
|
|
| | join predicates: a.id < b.item
|
|
| |
|
|
| |--02:SINGULAR ROW SRC
|
|
| |
|
|
| 03:UNNEST [a.int_array_col b]
|
|
|
|
|
00:SCAN HDFS [functional.allcomplextypes a]
|
|
partitions=0/0 files=0 size=0B
|
|
predicates: a.id < 10
|
|
predicates on b: b.item % 2 = 0
|
|
====
|
|
# Test subplans: Non-equi left outer join of parent and relative ref.
|
|
select a.id, b.item from functional.allcomplextypes a
|
|
left outer join a.int_array_col b on (a.id < b.item and b.item % 2 = 0)
|
|
where a.id < 10
|
|
---- PLAN
|
|
PLAN-ROOT SINK
|
|
|
|
|
01:SUBPLAN
|
|
|
|
|
|--04:NESTED LOOP JOIN [RIGHT OUTER JOIN]
|
|
| | join predicates: a.id < b.item
|
|
| |
|
|
| |--02:SINGULAR ROW SRC
|
|
| |
|
|
| 03:UNNEST [a.int_array_col b]
|
|
|
|
|
00:SCAN HDFS [functional.allcomplextypes a]
|
|
partitions=0/0 files=0 size=0B
|
|
predicates: a.id < 10
|
|
predicates on b: b.item % 2 = 0
|
|
====
|
|
# Test subplans: Non-equi right outer join of parent and relative ref.
|
|
select a.id, b.item from functional.allcomplextypes a
|
|
right outer join a.int_array_col b on (a.id < b.item and a.id < 10)
|
|
where b.item % 2 = 0
|
|
---- PLAN
|
|
PLAN-ROOT SINK
|
|
|
|
|
01:SUBPLAN
|
|
|
|
|
|--04:NESTED LOOP JOIN [LEFT OUTER JOIN]
|
|
| | join predicates: a.id < b.item
|
|
| |
|
|
| |--02:SINGULAR ROW SRC
|
|
| |
|
|
| 03:UNNEST [a.int_array_col b]
|
|
|
|
|
00:SCAN HDFS [functional.allcomplextypes a]
|
|
partitions=0/0 files=0 size=0B
|
|
predicates: a.id < 10
|
|
predicates on b: b.item % 2 = 0
|
|
====
|
|
# Test subplans: Non-equi full outer join of parent and relative ref.
|
|
select a.id, b.item from functional.allcomplextypes a
|
|
full outer join a.int_array_col b on (a.id < b.item and a.id < 10)
|
|
where b.item % 2 = 0
|
|
---- PLAN
|
|
PLAN-ROOT SINK
|
|
|
|
|
01:SUBPLAN
|
|
|
|
|
|--04:NESTED LOOP JOIN [FULL OUTER JOIN]
|
|
| | join predicates: a.id < 10, a.id < b.item
|
|
| | predicates: b.item % 2 = 0
|
|
| |
|
|
| |--02:SINGULAR ROW SRC
|
|
| |
|
|
| 03:UNNEST [a.int_array_col b]
|
|
|
|
|
00:SCAN HDFS [functional.allcomplextypes a]
|
|
partitions=0/0 files=0 size=0B
|
|
predicates on b: b.item % 2 = 0
|
|
====
|
|
# Test subplans: Inner equi-join of parent and relative ref.
|
|
select a.id, b.f1, b.f2 from functional.allcomplextypes a
|
|
inner join a.struct_array_col b
|
|
where a.id < 10 and b.f1 % 2 = 0 and b.f1 = a.id and b.f1 < a.year
|
|
---- PLAN
|
|
PLAN-ROOT SINK
|
|
|
|
|
01:SUBPLAN
|
|
|
|
|
|--04:NESTED LOOP JOIN [INNER JOIN]
|
|
| | join predicates: b.f1 = a.id
|
|
| | predicates: b.f1 < a.year
|
|
| |
|
|
| |--02:SINGULAR ROW SRC
|
|
| |
|
|
| 03:UNNEST [a.struct_array_col b]
|
|
|
|
|
00:SCAN HDFS [functional.allcomplextypes a]
|
|
partitions=0/0 files=0 size=0B
|
|
predicates: a.id < 10, a.id % 2 = 0, !empty(a.struct_array_col)
|
|
predicates on b: b.f1 < 10, b.f1 % 2 = 0
|
|
====
|
|
# Test subplans: Left-semi equi-join of parent and relative ref.
|
|
select a.id from functional.allcomplextypes a
|
|
left semi join a.struct_array_col b
|
|
on (b.f1 % 2 = 0 and b.f1 = a.id and b.f1 < a.year)
|
|
where a.id < 10
|
|
---- PLAN
|
|
PLAN-ROOT SINK
|
|
|
|
|
01:SUBPLAN
|
|
|
|
|
|--04:NESTED LOOP JOIN [RIGHT SEMI JOIN]
|
|
| | join predicates: b.f1 < a.year, b.f1 = a.id
|
|
| |
|
|
| |--02:SINGULAR ROW SRC
|
|
| |
|
|
| 03:UNNEST [a.struct_array_col b]
|
|
|
|
|
00:SCAN HDFS [functional.allcomplextypes a]
|
|
partitions=0/0 files=0 size=0B
|
|
predicates: a.id < 10, a.id % 2 = 0, !empty(a.struct_array_col)
|
|
predicates on b: b.f1 % 2 = 0, b.f1 < 10
|
|
====
|
|
# Test subplans: Right-semi equi-join of parent and relative ref.
|
|
select b.f1, b.f2 from functional.allcomplextypes a
|
|
right semi join a.struct_array_col b
|
|
on (a.id < 10 and b.f1 = a.id and b.f1 < a.year)
|
|
where b.f1 % 2 = 0
|
|
---- PLAN
|
|
PLAN-ROOT SINK
|
|
|
|
|
01:SUBPLAN
|
|
|
|
|
|--04:NESTED LOOP JOIN [LEFT SEMI JOIN]
|
|
| | join predicates: b.f1 < a.year, b.f1 = a.id
|
|
| |
|
|
| |--02:SINGULAR ROW SRC
|
|
| |
|
|
| 03:UNNEST [a.struct_array_col b]
|
|
|
|
|
00:SCAN HDFS [functional.allcomplextypes a]
|
|
partitions=0/0 files=0 size=0B
|
|
predicates: a.id < 10, a.id % 2 = 0, !empty(a.struct_array_col)
|
|
predicates on b: b.f1 < 10, b.f1 % 2 = 0
|
|
====
|
|
# Test subplans: Left-anti equi-join of parent and relative ref.
|
|
select a.id from functional.allcomplextypes a
|
|
left anti join a.struct_array_col b
|
|
on (b.f1 % 2 = 0 and b.f1 = a.id and b.f1 < a.year)
|
|
where a.id < 10
|
|
---- PLAN
|
|
PLAN-ROOT SINK
|
|
|
|
|
01:SUBPLAN
|
|
|
|
|
|--04:NESTED LOOP JOIN [RIGHT ANTI JOIN]
|
|
| | join predicates: b.f1 < a.year, b.f1 = a.id
|
|
| |
|
|
| |--02:SINGULAR ROW SRC
|
|
| |
|
|
| 03:UNNEST [a.struct_array_col b]
|
|
|
|
|
00:SCAN HDFS [functional.allcomplextypes a]
|
|
partitions=0/0 files=0 size=0B
|
|
predicates: a.id < 10
|
|
predicates on b: b.f1 % 2 = 0, b.f1 < 10
|
|
====
|
|
# Test subplans: Right-anti equi-join of parent and relative ref.
|
|
select b.f1, b.f2 from functional.allcomplextypes a
|
|
right anti join a.struct_array_col b
|
|
on (a.id < 10 and b.f1 = a.id and b.f1 < a.year)
|
|
where b.f1 % 2 = 0
|
|
---- PLAN
|
|
PLAN-ROOT SINK
|
|
|
|
|
01:SUBPLAN
|
|
|
|
|
|--04:NESTED LOOP JOIN [LEFT ANTI JOIN]
|
|
| | join predicates: b.f1 < a.year, b.f1 = a.id
|
|
| |
|
|
| |--02:SINGULAR ROW SRC
|
|
| |
|
|
| 03:UNNEST [a.struct_array_col b]
|
|
|
|
|
00:SCAN HDFS [functional.allcomplextypes a]
|
|
partitions=0/0 files=0 size=0B
|
|
predicates: a.id < 10, a.id % 2 = 0
|
|
predicates on b: b.f1 % 2 = 0
|
|
====
|
|
# Test subplans: Left-outer equi-join of parent and relative ref.
|
|
select a.id from functional.allcomplextypes a
|
|
left outer join a.struct_array_col b
|
|
on (b.f1 % 2 = 0 and b.f1 = a.id and b.f1 < a.year)
|
|
where a.id < 10
|
|
---- PLAN
|
|
PLAN-ROOT SINK
|
|
|
|
|
01:SUBPLAN
|
|
|
|
|
|--04:NESTED LOOP JOIN [RIGHT OUTER JOIN]
|
|
| | join predicates: b.f1 < a.year, b.f1 = a.id
|
|
| |
|
|
| |--02:SINGULAR ROW SRC
|
|
| |
|
|
| 03:UNNEST [a.struct_array_col b]
|
|
|
|
|
00:SCAN HDFS [functional.allcomplextypes a]
|
|
partitions=0/0 files=0 size=0B
|
|
predicates: a.id < 10
|
|
predicates on b: b.f1 % 2 = 0, b.f1 < 10
|
|
====
|
|
# Test subplans: Right-outer equi-join of parent and relative ref.
|
|
select b.f1, b.f2 from functional.allcomplextypes a
|
|
right outer join a.struct_array_col b
|
|
on (a.id < 10 and b.f1 = a.id and b.f1 < a.year)
|
|
where b.f1 % 2 = 0
|
|
---- PLAN
|
|
PLAN-ROOT SINK
|
|
|
|
|
01:SUBPLAN
|
|
|
|
|
|--04:NESTED LOOP JOIN [LEFT OUTER JOIN]
|
|
| | join predicates: b.f1 < a.year, b.f1 = a.id
|
|
| |
|
|
| |--02:SINGULAR ROW SRC
|
|
| |
|
|
| 03:UNNEST [a.struct_array_col b]
|
|
|
|
|
00:SCAN HDFS [functional.allcomplextypes a]
|
|
partitions=0/0 files=0 size=0B
|
|
predicates: a.id < 10, a.id % 2 = 0
|
|
predicates on b: b.f1 % 2 = 0
|
|
====
|
|
# Test subplans: Full-outer equi-join of parent and relative ref.
|
|
select b.f1, b.f2 from functional.allcomplextypes a
|
|
full outer join a.struct_array_col b
|
|
on (b.f1 = a.id and b.f1 < a.year)
|
|
where a.id < 10 and b.f1 % 2 = 0
|
|
---- PLAN
|
|
PLAN-ROOT SINK
|
|
|
|
|
01:SUBPLAN
|
|
|
|
|
|--04:NESTED LOOP JOIN [FULL OUTER JOIN]
|
|
| | join predicates: b.f1 < a.year, b.f1 = a.id
|
|
| | predicates: a.id < 10, b.f1 % 2 = 0
|
|
| |
|
|
| |--02:SINGULAR ROW SRC
|
|
| |
|
|
| 03:UNNEST [a.struct_array_col b]
|
|
|
|
|
00:SCAN HDFS [functional.allcomplextypes a]
|
|
partitions=0/0 files=0 size=0B
|
|
predicates: a.id < 10
|
|
predicates on b: b.f1 % 2 = 0
|
|
====
|
|
# Test subplans: Test multiple relative refs, disjunctive predicates,
|
|
# and correct join ordering within a subplan.
|
|
select 1 from functional.allcomplextypes a
|
|
inner join a.int_array_col b on (a.id < 1 or b.item > 2)
|
|
inner join a.int_map_col c on (a.year = c.value)
|
|
left outer join a.struct_array_col d on (a.month < 4 or d.f1 > 5)
|
|
inner join a.struct_map_col e on (e.f1 = a.id and e.f2 = 'test')
|
|
---- PLAN
|
|
PLAN-ROOT SINK
|
|
|
|
|
01:SUBPLAN
|
|
|
|
|
|--10:HASH JOIN [INNER JOIN]
|
|
| | hash predicates: a.id = e.f1
|
|
| |
|
|
| |--06:UNNEST [a.struct_map_col e]
|
|
| |
|
|
| 09:NESTED LOOP JOIN [LEFT OUTER JOIN]
|
|
| | join predicates: (a.month < 4 OR d.f1 > 5)
|
|
| |
|
|
| |--05:UNNEST [a.struct_array_col d]
|
|
| |
|
|
| 08:NESTED LOOP JOIN [INNER JOIN]
|
|
| | predicates: (a.id < 1 OR b.item > 2)
|
|
| |
|
|
| |--03:UNNEST [a.int_array_col b]
|
|
| |
|
|
| 07:NESTED LOOP JOIN [INNER JOIN]
|
|
| | join predicates: c.value = a.year
|
|
| |
|
|
| |--02:SINGULAR ROW SRC
|
|
| |
|
|
| 04:UNNEST [a.int_map_col c]
|
|
|
|
|
00:SCAN HDFS [functional.allcomplextypes a]
|
|
partitions=0/0 files=0 size=0B
|
|
predicates: !empty(a.int_array_col), !empty(a.int_map_col), !empty(a.struct_map_col)
|
|
predicates on e: e.f2 = 'test'
|
|
====
|
|
# Test subplans: Test that subplans are not re-ordered across semi/outer joins.
|
|
# The 'alltypes*' tables are purposely placed with increasing size to test
|
|
# join inversion.
|
|
select 1
|
|
from functional.allcomplextypes a
|
|
left outer join functional.alltypestiny b on (a.id = b.id)
|
|
left anti join functional.alltypessmall c on (b.int_col = c.int_col)
|
|
inner join functional.alltypes d on (b.id = d.id)
|
|
inner join a.struct_array_col e
|
|
where e.f1 < 10
|
|
---- PLAN
|
|
PLAN-ROOT SINK
|
|
|
|
|
11:HASH JOIN [INNER JOIN]
|
|
| hash predicates: d.id = b.id
|
|
| runtime filters: RF000 <- b.id
|
|
|
|
|
|--10:SUBPLAN
|
|
| |
|
|
| |--08:NESTED LOOP JOIN [CROSS JOIN]
|
|
| | |
|
|
| | |--06:SINGULAR ROW SRC
|
|
| | |
|
|
| | 07:UNNEST [a.struct_array_col e]
|
|
| |
|
|
| 09:HASH JOIN [RIGHT ANTI JOIN]
|
|
| | hash predicates: c.int_col = b.int_col
|
|
| |
|
|
| |--05:HASH JOIN [RIGHT OUTER JOIN]
|
|
| | | hash predicates: b.id = a.id
|
|
| | | runtime filters: RF001 <- a.id
|
|
| | |
|
|
| | |--00:SCAN HDFS [functional.allcomplextypes a]
|
|
| | | partitions=0/0 files=0 size=0B
|
|
| | | predicates: !empty(a.struct_array_col)
|
|
| | | predicates on e: e.f1 < 10
|
|
| | |
|
|
| | 01:SCAN HDFS [functional.alltypestiny b]
|
|
| | partitions=4/4 files=4 size=460B
|
|
| | runtime filters: RF001 -> b.id
|
|
| |
|
|
| 02:SCAN HDFS [functional.alltypessmall c]
|
|
| partitions=4/4 files=4 size=6.32KB
|
|
|
|
|
03:SCAN HDFS [functional.alltypes d]
|
|
partitions=24/24 files=24 size=478.45KB
|
|
runtime filters: RF000 -> d.id
|
|
====
|
|
# Test subplans: Same test as above but the relative table ref is wedged in between
|
|
# semi/outer joins, and the join types are different.
|
|
select 1
|
|
from functional.allcomplextypes a
|
|
full outer join functional.alltypestiny b on (a.id = b.id)
|
|
inner join a.struct_array_col e
|
|
right anti join functional.alltypessmall c on (b.int_col = c.int_col and e.f1 < 10)
|
|
inner join functional.alltypes d on (b.id = d.id)
|
|
---- PLAN
|
|
PLAN-ROOT SINK
|
|
|
|
|
11:HASH JOIN [INNER JOIN]
|
|
| hash predicates: d.id = b.id
|
|
|
|
|
|--10:HASH JOIN [RIGHT ANTI JOIN]
|
|
| | hash predicates: b.int_col = c.int_col
|
|
| |
|
|
| |--02:SCAN HDFS [functional.alltypessmall c]
|
|
| | partitions=4/4 files=4 size=6.32KB
|
|
| |
|
|
| 09:SUBPLAN
|
|
| |
|
|
| |--07:NESTED LOOP JOIN [CROSS JOIN]
|
|
| | |
|
|
| | |--05:SINGULAR ROW SRC
|
|
| | |
|
|
| | 06:UNNEST [a.struct_array_col e]
|
|
| |
|
|
| 08:HASH JOIN [FULL OUTER JOIN]
|
|
| | hash predicates: b.id = a.id
|
|
| |
|
|
| |--00:SCAN HDFS [functional.allcomplextypes a]
|
|
| | partitions=0/0 files=0 size=0B
|
|
| | predicates on e: e.f1 < 10
|
|
| |
|
|
| 01:SCAN HDFS [functional.alltypestiny b]
|
|
| partitions=4/4 files=4 size=460B
|
|
|
|
|
03:SCAN HDFS [functional.alltypes d]
|
|
partitions=24/24 files=24 size=478.45KB
|
|
====
|
|
# Test subplans: Test joining relative refs with independent table refs.
|
|
# The 'alltypes*' tables are purposely placed with increasing size to test
|
|
# join inversion.
|
|
select *
|
|
from functional.allcomplextypes a
|
|
inner join a.int_array_col b
|
|
left outer join functional.alltypessmall c on (b.item = c.id)
|
|
inner join a.int_map_col d
|
|
left semi join functional.alltypes e on (d.value = e.id)
|
|
where b.item < 10 and c.int_col > 30
|
|
---- PLAN
|
|
PLAN-ROOT SINK
|
|
|
|
|
12:HASH JOIN [RIGHT SEMI JOIN]
|
|
| hash predicates: e.id = d.value
|
|
| runtime filters: RF000 <- d.value
|
|
|
|
|
|--11:SUBPLAN
|
|
| |
|
|
| |--09:NESTED LOOP JOIN [CROSS JOIN]
|
|
| | |
|
|
| | |--07:SINGULAR ROW SRC
|
|
| | |
|
|
| | 08:UNNEST [a.int_map_col d]
|
|
| |
|
|
| 10:HASH JOIN [RIGHT OUTER JOIN]
|
|
| | hash predicates: c.id = b.item
|
|
| | other predicates: c.int_col > 30
|
|
| | runtime filters: RF001 <- b.item
|
|
| |
|
|
| |--01:SUBPLAN
|
|
| | |
|
|
| | |--04:NESTED LOOP JOIN [CROSS JOIN]
|
|
| | | |
|
|
| | | |--02:SINGULAR ROW SRC
|
|
| | | |
|
|
| | | 03:UNNEST [a.int_array_col b]
|
|
| | |
|
|
| | 00:SCAN HDFS [functional.allcomplextypes a]
|
|
| | partitions=0/0 files=0 size=0B
|
|
| | predicates: !empty(a.int_array_col), !empty(a.int_map_col)
|
|
| | predicates on b: b.item < 10
|
|
| |
|
|
| 05:SCAN HDFS [functional.alltypessmall c]
|
|
| partitions=4/4 files=4 size=6.32KB
|
|
| predicates: c.id < 10, c.int_col > 30
|
|
| runtime filters: RF001 -> c.id
|
|
|
|
|
06:SCAN HDFS [functional.alltypes e]
|
|
partitions=24/24 files=24 size=478.45KB
|
|
runtime filters: RF000 -> e.id
|
|
====
|
|
# Test subplans: Same as above but with different join types
|
|
select *
|
|
from functional.allcomplextypes a
|
|
inner join a.int_array_col b
|
|
full outer join functional.alltypessmall c on (b.item = c.id)
|
|
inner join a.int_map_col d
|
|
right anti join functional.alltypestiny e on (d.value = e.id)
|
|
where b.item < 10 and c.int_col > 30
|
|
---- PLAN
|
|
PLAN-ROOT SINK
|
|
|
|
|
12:HASH JOIN [RIGHT ANTI JOIN]
|
|
| hash predicates: d.value = e.id
|
|
|
|
|
|--06:SCAN HDFS [functional.alltypestiny e]
|
|
| partitions=4/4 files=4 size=460B
|
|
|
|
|
11:SUBPLAN
|
|
|
|
|
|--09:NESTED LOOP JOIN [CROSS JOIN]
|
|
| |
|
|
| |--07:SINGULAR ROW SRC
|
|
| |
|
|
| 08:UNNEST [a.int_map_col d]
|
|
|
|
|
10:HASH JOIN [FULL OUTER JOIN]
|
|
| hash predicates: c.id = b.item
|
|
| other predicates: b.item < 10, c.int_col > 30
|
|
|
|
|
|--01:SUBPLAN
|
|
| |
|
|
| |--04:NESTED LOOP JOIN [CROSS JOIN]
|
|
| | |
|
|
| | |--02:SINGULAR ROW SRC
|
|
| | |
|
|
| | 03:UNNEST [a.int_array_col b]
|
|
| |
|
|
| 00:SCAN HDFS [functional.allcomplextypes a]
|
|
| partitions=0/0 files=0 size=0B
|
|
| predicates on b: b.item < 10
|
|
|
|
|
05:SCAN HDFS [functional.alltypessmall c]
|
|
partitions=4/4 files=4 size=6.32KB
|
|
predicates: c.int_col > 30
|
|
====
|
|
# Test subplans: Parent scan and aggregate subplan.
|
|
select a.id, v.cnt
|
|
from functional.allcomplextypes a,
|
|
(select count(*) cnt from a.int_array_col) v
|
|
where v.cnt < 10
|
|
---- PLAN
|
|
PLAN-ROOT SINK
|
|
|
|
|
01:SUBPLAN
|
|
|
|
|
|--05:NESTED LOOP JOIN [CROSS JOIN]
|
|
| |
|
|
| |--02:SINGULAR ROW SRC
|
|
| |
|
|
| 04:AGGREGATE [FINALIZE]
|
|
| | output: count(*)
|
|
| | having: count(*) < 10
|
|
| |
|
|
| 03:UNNEST [a.int_array_col]
|
|
|
|
|
00:SCAN HDFS [functional.allcomplextypes a]
|
|
partitions=0/0 files=0 size=0B
|
|
====
|
|
# Test subplans: Parent scan and grouping aggregate subplan.
|
|
select a.id, v.f1, v.cnt
|
|
from functional.allcomplextypes a,
|
|
(select f1, count(*) cnt from a.struct_array_col group by f1) v
|
|
where v.cnt < 10
|
|
---- PLAN
|
|
PLAN-ROOT SINK
|
|
|
|
|
01:SUBPLAN
|
|
|
|
|
|--05:NESTED LOOP JOIN [CROSS JOIN]
|
|
| |
|
|
| |--02:SINGULAR ROW SRC
|
|
| |
|
|
| 04:AGGREGATE [FINALIZE]
|
|
| | output: count(*)
|
|
| | group by: f1
|
|
| | having: count(*) < 10
|
|
| |
|
|
| 03:UNNEST [a.struct_array_col]
|
|
|
|
|
00:SCAN HDFS [functional.allcomplextypes a]
|
|
partitions=0/0 files=0 size=0B
|
|
====
|
|
# Test subplans: Top-n inside subplan.
|
|
select a.id, v.f1, v.f2
|
|
from functional.allcomplextypes a,
|
|
(select * from a.struct_array_col order by f1 limit 10) v
|
|
where v.f2 = 'test'
|
|
---- PLAN
|
|
PLAN-ROOT SINK
|
|
|
|
|
01:SUBPLAN
|
|
|
|
|
|--06:NESTED LOOP JOIN [CROSS JOIN]
|
|
| |
|
|
| |--02:SINGULAR ROW SRC
|
|
| |
|
|
| 05:SELECT
|
|
| | predicates: item.f2 = 'test'
|
|
| |
|
|
| 04:TOP-N [LIMIT=10]
|
|
| | order by: f1 ASC
|
|
| |
|
|
| 03:UNNEST [a.struct_array_col]
|
|
|
|
|
00:SCAN HDFS [functional.allcomplextypes a]
|
|
partitions=0/0 files=0 size=0B
|
|
====
|
|
# Test subplans: Parent scan and analytic subplan.
|
|
select a.id, v.key, v.rnum
|
|
from functional.allcomplextypes a,
|
|
(select key, row_number() over (order by key) rnum from a.int_map_col) v
|
|
where v.key != 'bad'
|
|
---- PLAN
|
|
PLAN-ROOT SINK
|
|
|
|
|
01:SUBPLAN
|
|
|
|
|
|--07:NESTED LOOP JOIN [CROSS JOIN]
|
|
| |
|
|
| |--02:SINGULAR ROW SRC
|
|
| |
|
|
| 06:SELECT
|
|
| | predicates: key != 'bad'
|
|
| |
|
|
| 05:ANALYTIC
|
|
| | functions: row_number()
|
|
| | order by: key ASC
|
|
| | window: ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW
|
|
| |
|
|
| 04:SORT
|
|
| | order by: key ASC
|
|
| |
|
|
| 03:UNNEST [a.int_map_col]
|
|
|
|
|
00:SCAN HDFS [functional.allcomplextypes a]
|
|
partitions=0/0 files=0 size=0B
|
|
====
|
|
# Test subplans: Parent scan and uncorrelated scalar subquery.
|
|
select a.id from functional.allcomplextypes a
|
|
where id < (select avg(item) from a.int_array_col)
|
|
---- PLAN
|
|
PLAN-ROOT SINK
|
|
|
|
|
01:SUBPLAN
|
|
|
|
|
|--05:NESTED LOOP JOIN [RIGHT SEMI JOIN]
|
|
| | join predicates: id < avg(item)
|
|
| |
|
|
| |--02:SINGULAR ROW SRC
|
|
| |
|
|
| 04:AGGREGATE [FINALIZE]
|
|
| | output: avg(item)
|
|
| |
|
|
| 03:UNNEST [a.int_array_col]
|
|
|
|
|
00:SCAN HDFS [functional.allcomplextypes a]
|
|
partitions=0/0 files=0 size=0B
|
|
====
|
|
# Test subplans: Parent scan and uncorrelated exists subquery.
|
|
select a.id from functional.allcomplextypes a
|
|
where exists (select item from a.int_array_col where item > 100)
|
|
---- PLAN
|
|
PLAN-ROOT SINK
|
|
|
|
|
01:SUBPLAN
|
|
|
|
|
|--04:NESTED LOOP JOIN [RIGHT SEMI JOIN]
|
|
| |
|
|
| |--02:SINGULAR ROW SRC
|
|
| |
|
|
| 03:UNNEST [a.int_array_col]
|
|
|
|
|
00:SCAN HDFS [functional.allcomplextypes a]
|
|
partitions=0/0 files=0 size=0B
|
|
predicates on int_array_col: item > 100
|
|
====
|
|
# Test subplans: Parent scan and uncorrelated not exists subquery.
|
|
select a.id from functional.allcomplextypes a
|
|
where not exists (select item from a.int_array_col)
|
|
---- PLAN
|
|
PLAN-ROOT SINK
|
|
|
|
|
01:SUBPLAN
|
|
|
|
|
|--04:NESTED LOOP JOIN [RIGHT ANTI JOIN]
|
|
| |
|
|
| |--02:SINGULAR ROW SRC
|
|
| |
|
|
| 03:UNNEST [a.int_array_col]
|
|
|
|
|
00:SCAN HDFS [functional.allcomplextypes a]
|
|
partitions=0/0 files=0 size=0B
|
|
====
|
|
# Test subplans: Parent scan and correlated exists subquery
|
|
# without an equi-join condition.
|
|
select a.id from functional.allcomplextypes a
|
|
where exists (select m.key from a.struct_map_col m where a.id < m.f1)
|
|
---- PLAN
|
|
PLAN-ROOT SINK
|
|
|
|
|
01:SUBPLAN
|
|
|
|
|
|--04:NESTED LOOP JOIN [RIGHT SEMI JOIN]
|
|
| | join predicates: a.id < m.f1
|
|
| |
|
|
| |--02:SINGULAR ROW SRC
|
|
| |
|
|
| 03:UNNEST [a.struct_map_col m]
|
|
|
|
|
00:SCAN HDFS [functional.allcomplextypes a]
|
|
partitions=0/0 files=0 size=0B
|
|
====
|
|
# Test subplans: Parent scan and correlated not exists subquery
|
|
# without an equi-join condition.
|
|
select a.id from functional.allcomplextypes a
|
|
where not exists (select c.f2 from a.struct_array_col c where a.id < c.f1)
|
|
---- PLAN
|
|
PLAN-ROOT SINK
|
|
|
|
|
01:SUBPLAN
|
|
|
|
|
|--04:NESTED LOOP JOIN [RIGHT ANTI JOIN]
|
|
| | join predicates: a.id < c.f1
|
|
| |
|
|
| |--02:SINGULAR ROW SRC
|
|
| |
|
|
| 03:UNNEST [a.struct_array_col c]
|
|
|
|
|
00:SCAN HDFS [functional.allcomplextypes a]
|
|
partitions=0/0 files=0 size=0B
|
|
====
|
|
# Test subplans: Parent scan and a correlated IN subquery.
|
|
# Note: The Nested Loop Join here is intentional because there is no
|
|
# point in doing a hash join with a single build row.
|
|
select a.id
|
|
from functional.allcomplextypes a
|
|
where id in (select b.item from a.int_array_col b where a.year < b.item)
|
|
---- PLAN
|
|
PLAN-ROOT SINK
|
|
|
|
|
01:SUBPLAN
|
|
|
|
|
|--04:NESTED LOOP JOIN [RIGHT SEMI JOIN]
|
|
| | join predicates: a.year < b.item, b.item = id
|
|
| |
|
|
| |--02:SINGULAR ROW SRC
|
|
| |
|
|
| 03:UNNEST [a.int_array_col b]
|
|
|
|
|
00:SCAN HDFS [functional.allcomplextypes a]
|
|
partitions=0/0 files=0 size=0B
|
|
====
|
|
# Test subplans: Parent scan and an uncorrelated NOT IN subquery.
|
|
# Note: We must use a hash join because the nested-loop join does not support
|
|
# the null-aware anti join mode. Also, we cannot invert the join because the
|
|
# null-aware right anti join is not supported.
|
|
select a.id
|
|
from functional.allcomplextypes a
|
|
where id not in (select b.item from a.int_array_col b)
|
|
---- PLAN
|
|
PLAN-ROOT SINK
|
|
|
|
|
01:SUBPLAN
|
|
|
|
|
|--04:HASH JOIN [NULL AWARE LEFT ANTI JOIN]
|
|
| | hash predicates: id = b.item
|
|
| |
|
|
| |--03:UNNEST [a.int_array_col b]
|
|
| |
|
|
| 02:SINGULAR ROW SRC
|
|
|
|
|
00:SCAN HDFS [functional.allcomplextypes a]
|
|
partitions=0/0 files=0 size=0B
|
|
====
|
|
# Test subplans: Parent scan and a correlated NOT IN subquery.
|
|
# Note: We must use a hash join because the nested-loop join does not support
|
|
# the null-aware anti join mode. Also, we cannot invert the join because the
|
|
# null-aware right anti join is not supported.
|
|
select a.id
|
|
from functional.allcomplextypes a
|
|
where id not in (select b.item from a.int_array_col b where a.year < b.item)
|
|
---- PLAN
|
|
PLAN-ROOT SINK
|
|
|
|
|
01:SUBPLAN
|
|
|
|
|
|--04:HASH JOIN [NULL AWARE LEFT ANTI JOIN]
|
|
| | hash predicates: id = b.item
|
|
| | other join predicates: a.year < b.item
|
|
| |
|
|
| |--03:UNNEST [a.int_array_col b]
|
|
| |
|
|
| 02:SINGULAR ROW SRC
|
|
|
|
|
00:SCAN HDFS [functional.allcomplextypes a]
|
|
partitions=0/0 files=0 size=0B
|
|
====
|
|
# Test subplans: Bushy plan with multiple subplans.
|
|
select a.id, c.item, d.key, d.value, v.cnt
|
|
from functional.allcomplextypes a
|
|
inner join functional.allcomplextypes b on a.id = b.id
|
|
cross join a.int_array_col c
|
|
cross join b.int_map_col d
|
|
cross join
|
|
(select count(*) cnt
|
|
from a.struct_array_col x inner join b.struct_map_col y
|
|
on x.f1 = y.f1) v
|
|
---- PLAN
|
|
PLAN-ROOT SINK
|
|
|
|
|
17:SUBPLAN
|
|
|
|
|
|--15:NESTED LOOP JOIN [CROSS JOIN]
|
|
| |
|
|
| |--10:SINGULAR ROW SRC
|
|
| |
|
|
| 14:AGGREGATE [FINALIZE]
|
|
| | output: count(*)
|
|
| |
|
|
| 13:HASH JOIN [INNER JOIN]
|
|
| | hash predicates: x.f1 = y.f1
|
|
| |
|
|
| |--12:UNNEST [b.struct_map_col y]
|
|
| |
|
|
| 11:UNNEST [a.struct_array_col x]
|
|
|
|
|
16:HASH JOIN [INNER JOIN]
|
|
| hash predicates: a.id = b.id
|
|
| runtime filters: RF000 <- b.id
|
|
|
|
|
|--06:SUBPLAN
|
|
| |
|
|
| |--09:NESTED LOOP JOIN [CROSS JOIN]
|
|
| | |
|
|
| | |--07:SINGULAR ROW SRC
|
|
| | |
|
|
| | 08:UNNEST [b.int_map_col d]
|
|
| |
|
|
| 05:SCAN HDFS [functional.allcomplextypes b]
|
|
| partitions=0/0 files=0 size=0B
|
|
| predicates: !empty(b.int_map_col)
|
|
|
|
|
01:SUBPLAN
|
|
|
|
|
|--04:NESTED LOOP JOIN [CROSS JOIN]
|
|
| |
|
|
| |--02:SINGULAR ROW SRC
|
|
| |
|
|
| 03:UNNEST [a.int_array_col c]
|
|
|
|
|
00:SCAN HDFS [functional.allcomplextypes a]
|
|
partitions=0/0 files=0 size=0B
|
|
predicates: !empty(a.int_array_col)
|
|
runtime filters: RF000 -> a.id
|
|
====
|
|
# Test subplans: Same as above but with an INNER JOIN between c and d.
|
|
select a.id, c.item, d.key, d.value, v.cnt
|
|
from functional.allcomplextypes a
|
|
inner join functional.allcomplextypes b on a.id = b.id
|
|
cross join a.int_array_col c
|
|
inner join b.int_map_col d on (c.item = d.value)
|
|
cross join
|
|
(select count(*) cnt
|
|
from a.struct_array_col x inner join b.struct_map_col y
|
|
on x.f1 = y.f1) v
|
|
where b.id = d.value
|
|
---- PLAN
|
|
PLAN-ROOT SINK
|
|
|
|
|
17:SUBPLAN
|
|
|
|
|
|--15:NESTED LOOP JOIN [CROSS JOIN]
|
|
| |
|
|
| |--10:SINGULAR ROW SRC
|
|
| |
|
|
| 14:AGGREGATE [FINALIZE]
|
|
| | output: count(*)
|
|
| |
|
|
| 13:HASH JOIN [INNER JOIN]
|
|
| | hash predicates: x.f1 = y.f1
|
|
| |
|
|
| |--12:UNNEST [b.struct_map_col y]
|
|
| |
|
|
| 11:UNNEST [a.struct_array_col x]
|
|
|
|
|
16:HASH JOIN [INNER JOIN]
|
|
| hash predicates: a.id = b.id
|
|
| runtime filters: RF000 <- b.id
|
|
|
|
|
|--06:SUBPLAN
|
|
| |
|
|
| |--09:NESTED LOOP JOIN [INNER JOIN]
|
|
| | | join predicates: d.value = b.id
|
|
| | |
|
|
| | |--07:SINGULAR ROW SRC
|
|
| | |
|
|
| | 08:UNNEST [b.int_map_col d]
|
|
| |
|
|
| 05:SCAN HDFS [functional.allcomplextypes b]
|
|
| partitions=0/0 files=0 size=0B
|
|
| predicates: !empty(b.int_map_col)
|
|
|
|
|
01:SUBPLAN
|
|
|
|
|
|--04:NESTED LOOP JOIN [INNER JOIN]
|
|
| | join predicates: c.item = a.id
|
|
| |
|
|
| |--02:SINGULAR ROW SRC
|
|
| |
|
|
| 03:UNNEST [a.int_array_col c]
|
|
|
|
|
00:SCAN HDFS [functional.allcomplextypes a]
|
|
partitions=0/0 files=0 size=0B
|
|
predicates: !empty(a.int_array_col)
|
|
runtime filters: RF000 -> a.id
|
|
====
|
|
# Test subplans: Same as above but with a LEFT OUTER JOIN between c and d.
|
|
# The outer join needs to be moved after the join between a and b to
|
|
# correctly evaluate the On-clause.
|
|
select a.id, c.item, d.key, d.value, v.cnt
|
|
from functional.allcomplextypes a
|
|
inner join functional.allcomplextypes b on a.id = b.id
|
|
cross join a.int_array_col c
|
|
left outer join b.int_map_col d on (c.item = d.value)
|
|
cross join
|
|
(select count(*) cnt
|
|
from a.struct_array_col x inner join b.struct_map_col y
|
|
on x.f1 = y.f1) v
|
|
---- PLAN
|
|
PLAN-ROOT SINK
|
|
|
|
|
15:SUBPLAN
|
|
|
|
|
|--13:NESTED LOOP JOIN [CROSS JOIN]
|
|
| |
|
|
| |--11:AGGREGATE [FINALIZE]
|
|
| | | output: count(*)
|
|
| | |
|
|
| | 10:HASH JOIN [INNER JOIN]
|
|
| | | hash predicates: x.f1 = y.f1
|
|
| | |
|
|
| | |--09:UNNEST [b.struct_map_col y]
|
|
| | |
|
|
| | 08:UNNEST [a.struct_array_col x]
|
|
| |
|
|
| 12:NESTED LOOP JOIN [RIGHT OUTER JOIN]
|
|
| | join predicates: d.value = c.item
|
|
| |
|
|
| |--06:SINGULAR ROW SRC
|
|
| |
|
|
| 07:UNNEST [b.int_map_col d]
|
|
|
|
|
14:HASH JOIN [INNER JOIN]
|
|
| hash predicates: a.id = b.id
|
|
| runtime filters: RF000 <- b.id
|
|
|
|
|
|--05:SCAN HDFS [functional.allcomplextypes b]
|
|
| partitions=0/0 files=0 size=0B
|
|
|
|
|
01:SUBPLAN
|
|
|
|
|
|--04:NESTED LOOP JOIN [CROSS JOIN]
|
|
| |
|
|
| |--02:SINGULAR ROW SRC
|
|
| |
|
|
| 03:UNNEST [a.int_array_col c]
|
|
|
|
|
00:SCAN HDFS [functional.allcomplextypes a]
|
|
partitions=0/0 files=0 size=0B
|
|
predicates: !empty(a.int_array_col)
|
|
runtime filters: RF000 -> a.id
|
|
====
|
|
# Test subplans: Nested subplans.
|
|
select 1
|
|
from tpch_nested_parquet.customer c, c.c_orders o, o.o_lineitems
|
|
where c_custkey < 10 and o_orderkey < 5 and l_linenumber < 3
|
|
limit 10
|
|
---- PLAN
|
|
PLAN-ROOT SINK
|
|
|
|
|
01:SUBPLAN
|
|
| limit: 10
|
|
|
|
|
|--08:NESTED LOOP JOIN [CROSS JOIN]
|
|
| |
|
|
| |--02:SINGULAR ROW SRC
|
|
| |
|
|
| 04:SUBPLAN
|
|
| |
|
|
| |--07:NESTED LOOP JOIN [CROSS JOIN]
|
|
| | |
|
|
| | |--05:SINGULAR ROW SRC
|
|
| | |
|
|
| | 06:UNNEST [o.o_lineitems]
|
|
| |
|
|
| 03:UNNEST [c.c_orders o]
|
|
|
|
|
00:SCAN HDFS [tpch_nested_parquet.customer c]
|
|
partitions=1/1 files=4 size=577.87MB
|
|
predicates: c_custkey < 10, !empty(c.c_orders)
|
|
predicates on o: !empty(o.o_lineitems), o_orderkey < 5
|
|
predicates on o_lineitems: l_linenumber < 3
|
|
====
|
|
# Nested subplans.
|
|
select 1
|
|
from functional.allcomplextypes a
|
|
cross join
|
|
(select m1.key from a.map_map_col m1,
|
|
(select m2.key from m1.value m2) v1) v2
|
|
---- PLAN
|
|
PLAN-ROOT SINK
|
|
|
|
|
01:SUBPLAN
|
|
|
|
|
|--08:NESTED LOOP JOIN [CROSS JOIN]
|
|
| |
|
|
| |--02:SINGULAR ROW SRC
|
|
| |
|
|
| 04:SUBPLAN
|
|
| |
|
|
| |--07:NESTED LOOP JOIN [CROSS JOIN]
|
|
| | |
|
|
| | |--05:SINGULAR ROW SRC
|
|
| | |
|
|
| | 06:UNNEST [m1.value m2]
|
|
| |
|
|
| 03:UNNEST [a.map_map_col m1]
|
|
|
|
|
00:SCAN HDFS [functional.allcomplextypes a]
|
|
partitions=0/0 files=0 size=0B
|
|
====
|
|
# Test subplans: straight_join should place the Subplan in FROM-clause order
|
|
# while coalescing adjacent ones.
|
|
select /* +straight_join */ a.id, v1.c, v2.a
|
|
from functional.allcomplextypes a
|
|
inner join functional.allcomplextypes b on (a.id = b.id)
|
|
cross join (select count(*) c from a.int_map_col) v1
|
|
cross join (select avg(item) a from b.int_array_col) v2
|
|
---- PLAN
|
|
PLAN-ROOT SINK
|
|
|
|
|
10:SUBPLAN
|
|
|
|
|
|--08:NESTED LOOP JOIN [CROSS JOIN]
|
|
| |
|
|
| |--06:AGGREGATE [FINALIZE]
|
|
| | | output: avg(item)
|
|
| | |
|
|
| | 05:UNNEST [b.int_array_col]
|
|
| |
|
|
| 07:NESTED LOOP JOIN [CROSS JOIN]
|
|
| |
|
|
| |--04:AGGREGATE [FINALIZE]
|
|
| | | output: count(*)
|
|
| | |
|
|
| | 03:UNNEST [a.int_map_col]
|
|
| |
|
|
| 02:SINGULAR ROW SRC
|
|
|
|
|
09:HASH JOIN [INNER JOIN]
|
|
| hash predicates: a.id = b.id
|
|
| runtime filters: RF000 <- b.id
|
|
|
|
|
|--01:SCAN HDFS [functional.allcomplextypes b]
|
|
| partitions=0/0 files=0 size=0B
|
|
|
|
|
00:SCAN HDFS [functional.allcomplextypes a]
|
|
partitions=0/0 files=0 size=0B
|
|
runtime filters: RF000 -> a.id
|
|
====
|
|
# Test subplans: Enforcement of slot equivalences and removal
|
|
# of redundant predicates.
|
|
select 1 from tpch_nested_parquet.customer c, c.c_orders o, o.o_lineitems l
|
|
# conjuncts form a single equivalence class
|
|
where c.c_custkey = o.o_orderkey and c.c_custkey = o.o_shippriority
|
|
and c.c_custkey = l.l_partkey and o.o_shippriority = l.l_linenumber
|
|
and o.o_orderkey = l.l_suppkey and c.c_nationkey = l.l_linenumber
|
|
# redundant predicates
|
|
and o.o_orderkey = l.l_partkey and o.o_shippriority = l.l_suppkey
|
|
---- PLAN
|
|
PLAN-ROOT SINK
|
|
|
|
|
01:SUBPLAN
|
|
|
|
|
|--08:NESTED LOOP JOIN [INNER JOIN]
|
|
| | join predicates: o.o_orderkey = c.c_custkey
|
|
| |
|
|
| |--02:SINGULAR ROW SRC
|
|
| |
|
|
| 04:SUBPLAN
|
|
| |
|
|
| |--07:NESTED LOOP JOIN [INNER JOIN]
|
|
| | | join predicates: l.l_linenumber = o.o_shippriority
|
|
| | |
|
|
| | |--05:SINGULAR ROW SRC
|
|
| | |
|
|
| | 06:UNNEST [o.o_lineitems l]
|
|
| |
|
|
| 03:UNNEST [c.c_orders o]
|
|
|
|
|
00:SCAN HDFS [tpch_nested_parquet.customer c]
|
|
partitions=1/1 files=4 size=577.87MB
|
|
predicates: c.c_custkey = c.c_nationkey, !empty(c.c_orders)
|
|
predicates on o: !empty(o.o_lineitems), o.o_orderkey = o.o_shippriority
|
|
predicates on l: l.l_partkey = l.l_linenumber, l.l_partkey = l.l_suppkey
|
|
====
|
|
# Test assignment of nested conjuncts in the parent scan and its limitations.
|
|
select *
|
|
from functional.allcomplextypes t,
|
|
t.int_array_col a,
|
|
(select * from t.int_map_col m where m.key = 'test' and m.value != 30 limit 1) v1,
|
|
t.complex_nested_struct_col.f2 c,
|
|
(select key, f21 as value, coalesce(key, cast(f21 as string)) x from c.f12) v2
|
|
where a.item between 10 and 20
|
|
and c.f11 % 2 = 0
|
|
and a.item < v1.value
|
|
and c.f11 = a.item
|
|
and t.id < 200
|
|
and v2.key = 'test2'
|
|
and v2.x = 'test3'
|
|
---- PLAN
|
|
PLAN-ROOT SINK
|
|
|
|
|
01:SUBPLAN
|
|
|
|
|
|--12:NESTED LOOP JOIN [INNER JOIN]
|
|
| | predicates: a.item < m.value
|
|
| |
|
|
| |--04:UNNEST [t.int_map_col m]
|
|
| | limit: 1
|
|
| |
|
|
| 11:NESTED LOOP JOIN [CROSS JOIN]
|
|
| |
|
|
| |--02:SINGULAR ROW SRC
|
|
| |
|
|
| 10:HASH JOIN [INNER JOIN]
|
|
| | hash predicates: c.f11 = a.item
|
|
| |
|
|
| |--03:UNNEST [t.int_array_col a]
|
|
| |
|
|
| 06:SUBPLAN
|
|
| |
|
|
| |--09:NESTED LOOP JOIN [CROSS JOIN]
|
|
| | |
|
|
| | |--07:SINGULAR ROW SRC
|
|
| | |
|
|
| | 08:UNNEST [c.f12]
|
|
| | predicates: coalesce(key, CAST(f21 AS STRING)) = 'test3'
|
|
| |
|
|
| 05:UNNEST [t.complex_nested_struct_col.f2 c]
|
|
|
|
|
00:SCAN HDFS [functional.allcomplextypes t]
|
|
partitions=0/0 files=0 size=0B
|
|
predicates: t.id < 200, !empty(t.complex_nested_struct_col.f2), !empty(t.int_array_col)
|
|
predicates on a: a.item >= 10, a.item <= 20, a.item % 2 = 0
|
|
predicates on m: m.key = 'test', m.value != 30
|
|
predicates on c: c.f11 >= 10, c.f11 <= 20, c.f11 % 2 = 0
|
|
predicates on f12: f12.key = 'test2'
|
|
====
|
|
# IMPALA-2358: Test join ordering of relative collection table refs inside
|
|
# a subquery.
|
|
select 1
|
|
from tpch_nested_parquet.supplier s
|
|
where s.s_suppkey not in
|
|
(select ps1.ps_partkey
|
|
from s.s_partsupps ps1
|
|
left outer join s.s_partsupps ps2
|
|
on ps1.ps_supplycost = ps2.ps_supplycost
|
|
# This join has an ordering dependency on ps2, and should be in the same subplan as ps2.
|
|
inner join s.s_partsupps ps3
|
|
on ps2.ps_comment = ps3.ps_comment)
|
|
---- PLAN
|
|
PLAN-ROOT SINK
|
|
|
|
|
01:SUBPLAN
|
|
|
|
|
|--08:HASH JOIN [NULL AWARE LEFT ANTI JOIN]
|
|
| | hash predicates: s.s_suppkey = ps1.ps_partkey
|
|
| |
|
|
| |--07:HASH JOIN [INNER JOIN]
|
|
| | | hash predicates: ps2.ps_comment = ps3.ps_comment
|
|
| | |
|
|
| | |--05:UNNEST [s.s_partsupps ps3]
|
|
| | |
|
|
| | 06:HASH JOIN [LEFT OUTER JOIN]
|
|
| | | hash predicates: ps1.ps_supplycost = ps2.ps_supplycost
|
|
| | |
|
|
| | |--04:UNNEST [s.s_partsupps ps2]
|
|
| | |
|
|
| | 03:UNNEST [s.s_partsupps ps1]
|
|
| |
|
|
| 02:SINGULAR ROW SRC
|
|
|
|
|
00:SCAN HDFS [tpch_nested_parquet.supplier s]
|
|
partitions=1/1 files=1 size=111.08MB
|
|
====
|
|
# IMPALA-2383: Test join ordering of relative collection ref after an outer join.
|
|
select 1 from functional.allcomplextypes t1
|
|
left outer join functional.allcomplextypes t2 ON (t1.id = t2.id)
|
|
# The subplan for this table ref must come after the outer join of t1 and t2.
|
|
inner join t2.int_array_col
|
|
---- PLAN
|
|
PLAN-ROOT SINK
|
|
|
|
|
06:SUBPLAN
|
|
|
|
|
|--04:NESTED LOOP JOIN [CROSS JOIN]
|
|
| |
|
|
| |--02:SINGULAR ROW SRC
|
|
| |
|
|
| 03:UNNEST [t2.int_array_col]
|
|
|
|
|
05:HASH JOIN [LEFT OUTER JOIN]
|
|
| hash predicates: t1.id = t2.id
|
|
|
|
|
|--01:SCAN HDFS [functional.allcomplextypes t2]
|
|
| partitions=0/0 files=0 size=0B
|
|
|
|
|
00:SCAN HDFS [functional.allcomplextypes t1]
|
|
partitions=0/0 files=0 size=0B
|
|
====
|
|
# IMPALA-2401: Test correlated inline view with an analytic function and grouping.
|
|
select a from functional.allcomplextypes t,
|
|
(select count(*) over(partition by key) a
|
|
from t.int_map_col group by key) v
|
|
---- PLAN
|
|
PLAN-ROOT SINK
|
|
|
|
|
01:SUBPLAN
|
|
|
|
|
|--07:NESTED LOOP JOIN [CROSS JOIN]
|
|
| |
|
|
| |--02:SINGULAR ROW SRC
|
|
| |
|
|
| 06:ANALYTIC
|
|
| | functions: count(*)
|
|
| | partition by: key
|
|
| |
|
|
| 05:SORT
|
|
| | order by: key ASC NULLS FIRST
|
|
| |
|
|
| 04:AGGREGATE [FINALIZE]
|
|
| | group by: key
|
|
| |
|
|
| 03:UNNEST [t.int_map_col]
|
|
|
|
|
00:SCAN HDFS [functional.allcomplextypes t]
|
|
partitions=0/0 files=0 size=0B
|
|
====
|
|
# IMPALA-2349: Test planning of nested subplans with straight_join.
|
|
select straight_join 1
|
|
from functional.allcomplextypes t1
|
|
left outer join functional.allcomplextypes t2 on (t1.id = t2.id)
|
|
inner join t1.map_map_col m1
|
|
inner join m1.value m2
|
|
---- PLAN
|
|
PLAN-ROOT SINK
|
|
|
|
|
10:SUBPLAN
|
|
|
|
|
|--08:SUBPLAN
|
|
| |
|
|
| |--06:NESTED LOOP JOIN [CROSS JOIN]
|
|
| | |
|
|
| | |--05:UNNEST [m1.value m2]
|
|
| | |
|
|
| | 04:SINGULAR ROW SRC
|
|
| |
|
|
| 07:NESTED LOOP JOIN [CROSS JOIN]
|
|
| |
|
|
| |--03:UNNEST [t1.map_map_col m1]
|
|
| |
|
|
| 02:SINGULAR ROW SRC
|
|
|
|
|
09:HASH JOIN [LEFT OUTER JOIN]
|
|
| hash predicates: t1.id = t2.id
|
|
|
|
|
|--01:SCAN HDFS [functional.allcomplextypes t2]
|
|
| partitions=0/0 files=0 size=0B
|
|
|
|
|
00:SCAN HDFS [functional.allcomplextypes t1]
|
|
partitions=0/0 files=0 size=0B
|
|
predicates: !empty(t1.map_map_col)
|
|
predicates on m1: !empty(m1.value)
|
|
====
|
|
# IMPALA-2412: Test join ordering in nested subplans.
|
|
select 1
|
|
from tpch_nested_parquet.customer c
|
|
left outer join c.c_orders o1 on o1.pos = c.c_custkey
|
|
where c.c_custkey in
|
|
(select o2.pos
|
|
from c.c_orders o2
|
|
left outer join o2.o_lineitems l
|
|
# This join has an ordering dependency on l because l is outer joined,
|
|
# and this join must be in the same subplan as o1 and o2.
|
|
left outer join c.c_orders o3 on o3.pos = o2.pos
|
|
where c.c_custkey = o2.pos)
|
|
---- PLAN
|
|
PLAN-ROOT SINK
|
|
|
|
|
01:SUBPLAN
|
|
|
|
|
|--12:HASH JOIN [RIGHT SEMI JOIN]
|
|
| | hash predicates: o2.pos = c.c_custkey
|
|
| |
|
|
| |--11:NESTED LOOP JOIN [RIGHT OUTER JOIN]
|
|
| | | join predicates: o1.pos = c.c_custkey
|
|
| | |
|
|
| | |--02:SINGULAR ROW SRC
|
|
| | |
|
|
| | 03:UNNEST [c.c_orders o1]
|
|
| |
|
|
| 10:HASH JOIN [LEFT OUTER JOIN]
|
|
| | hash predicates: o2.pos = o3.pos
|
|
| |
|
|
| |--09:UNNEST [c.c_orders o3]
|
|
| |
|
|
| 05:SUBPLAN
|
|
| |
|
|
| |--08:NESTED LOOP JOIN [RIGHT OUTER JOIN]
|
|
| | |
|
|
| | |--06:SINGULAR ROW SRC
|
|
| | |
|
|
| | 07:UNNEST [o2.o_lineitems l]
|
|
| |
|
|
| 04:UNNEST [c.c_orders o2]
|
|
|
|
|
00:SCAN HDFS [tpch_nested_parquet.customer c]
|
|
partitions=1/1 files=4 size=577.87MB
|
|
====
|
|
# IMPALA-2412: Test join ordering in nested subplans. Same as above
|
|
# but with a few inner joins.
|
|
select 1
|
|
from tpch_nested_parquet.customer c
|
|
inner join c.c_orders o1 on o1.pos = c.c_custkey
|
|
where c.c_custkey in
|
|
(select o2.pos
|
|
from c.c_orders o2
|
|
left outer join o2.o_lineitems l
|
|
# This join has an ordering dependency on l because l is outer joined,
|
|
# and this join must be in the same subplan as o1 and o2.
|
|
inner join c.c_orders o3 on o3.pos = o2.pos
|
|
where c.c_custkey = o2.pos)
|
|
---- PLAN
|
|
PLAN-ROOT SINK
|
|
|
|
|
01:SUBPLAN
|
|
|
|
|
|--12:HASH JOIN [RIGHT SEMI JOIN]
|
|
| | hash predicates: o2.pos = c.c_custkey
|
|
| |
|
|
| |--11:NESTED LOOP JOIN [INNER JOIN]
|
|
| | | join predicates: o1.pos = c.c_custkey
|
|
| | |
|
|
| | |--02:SINGULAR ROW SRC
|
|
| | |
|
|
| | 03:UNNEST [c.c_orders o1]
|
|
| |
|
|
| 10:HASH JOIN [INNER JOIN]
|
|
| | hash predicates: o2.pos = o3.pos
|
|
| |
|
|
| |--09:UNNEST [c.c_orders o3]
|
|
| |
|
|
| 05:SUBPLAN
|
|
| |
|
|
| |--08:NESTED LOOP JOIN [RIGHT OUTER JOIN]
|
|
| | |
|
|
| | |--06:SINGULAR ROW SRC
|
|
| | |
|
|
| | 07:UNNEST [o2.o_lineitems l]
|
|
| |
|
|
| 04:UNNEST [c.c_orders o2]
|
|
|
|
|
00:SCAN HDFS [tpch_nested_parquet.customer c]
|
|
partitions=1/1 files=4 size=577.87MB
|
|
predicates: !empty(c.c_orders)
|
|
====
|
|
# IMPALA-2412: Test join ordering in nested subplans.
|
|
select 1
|
|
from tpch_nested_parquet.customer c
|
|
left outer join c.c_orders o1 on o1.pos = c.c_custkey
|
|
where c.c_custkey in
|
|
(select o2.pos
|
|
from c.c_orders o2
|
|
left outer join c.c_orders o3 on o3.pos = o2.pos
|
|
left outer join o2.o_lineitems l
|
|
where c.c_custkey = o2.pos)
|
|
---- PLAN
|
|
PLAN-ROOT SINK
|
|
|
|
|
01:SUBPLAN
|
|
|
|
|
|--12:HASH JOIN [RIGHT SEMI JOIN]
|
|
| | hash predicates: o2.pos = c.c_custkey
|
|
| |
|
|
| |--11:NESTED LOOP JOIN [RIGHT OUTER JOIN]
|
|
| | | join predicates: o1.pos = c.c_custkey
|
|
| | |
|
|
| | |--02:SINGULAR ROW SRC
|
|
| | |
|
|
| | 03:UNNEST [c.c_orders o1]
|
|
| |
|
|
| 10:SUBPLAN
|
|
| |
|
|
| |--08:NESTED LOOP JOIN [RIGHT OUTER JOIN]
|
|
| | |
|
|
| | |--06:SINGULAR ROW SRC
|
|
| | |
|
|
| | 07:UNNEST [o2.o_lineitems l]
|
|
| |
|
|
| 09:HASH JOIN [LEFT OUTER JOIN]
|
|
| | hash predicates: o2.pos = o3.pos
|
|
| |
|
|
| |--05:UNNEST [c.c_orders o3]
|
|
| |
|
|
| 04:UNNEST [c.c_orders o2]
|
|
|
|
|
00:SCAN HDFS [tpch_nested_parquet.customer c]
|
|
partitions=1/1 files=4 size=577.87MB
|
|
====
|
|
# IMPALA-2446: Test predicate assignment when outer join has no conjuncts in
|
|
# the ON clause and there are predicates in the WHERE clause that can be assigned to
|
|
# the join node.
|
|
select straight_join id from functional.allcomplextypes t1 left outer join t1.int_array_col t2
|
|
where t1.id = t2.pos and t1.int_struct_col.f1 = 10 and t2.item = 1
|
|
---- PLAN
|
|
PLAN-ROOT SINK
|
|
|
|
|
01:SUBPLAN
|
|
|
|
|
|--04:HASH JOIN [LEFT OUTER JOIN]
|
|
| | hash predicates: t1.id = t2.pos
|
|
| | other predicates: t2.item = 1, t1.id = t2.pos
|
|
| |
|
|
| |--03:UNNEST [t1.int_array_col t2]
|
|
| |
|
|
| 02:SINGULAR ROW SRC
|
|
|
|
|
00:SCAN HDFS [functional.allcomplextypes t1]
|
|
partitions=0/0 files=0 size=0B
|
|
predicates: t1.int_struct_col.f1 = 10
|
|
predicates on t2: t2.item = 1
|
|
====
|
|
# IMPALA-2446: Test predicate assignment when right outer join has no conjuncts in
|
|
# the ON clause and there are predicates in the WHERE clause that can be assigned to
|
|
# the join node.
|
|
select straight_join id from functional.allcomplextypes t1 right outer join t1.int_array_col t2
|
|
where t1.id = t2.pos and t1.int_struct_col.f1 = 10 and t2.item = 1
|
|
---- PLAN
|
|
PLAN-ROOT SINK
|
|
|
|
|
01:SUBPLAN
|
|
|
|
|
|--04:HASH JOIN [RIGHT OUTER JOIN]
|
|
| | hash predicates: t1.id = t2.pos
|
|
| | other predicates: t1.int_struct_col.f1 = 10, t1.id = t2.pos
|
|
| |
|
|
| |--03:UNNEST [t1.int_array_col t2]
|
|
| |
|
|
| 02:SINGULAR ROW SRC
|
|
|
|
|
00:SCAN HDFS [functional.allcomplextypes t1]
|
|
partitions=0/0 files=0 size=0B
|
|
predicates: t1.int_struct_col.f1 = 10
|
|
predicates on t2: t2.item = 1
|
|
====
|
|
# IMPALA-2446: Test predicate assignment when full outer join has no conjuncts in
|
|
# the ON clause and there are predicates in the WHERE clause that can be assigned to
|
|
# the join node.
|
|
select id from functional.allcomplextypes t1 full outer join t1.int_array_col t2
|
|
where t1.id = t2.pos and t1.int_struct_col.f1 = 10 and t2.item = 1
|
|
---- PLAN
|
|
PLAN-ROOT SINK
|
|
|
|
|
01:SUBPLAN
|
|
|
|
|
|--04:NESTED LOOP JOIN [FULL OUTER JOIN]
|
|
| | join predicates: t2.pos = t1.id
|
|
| | predicates: t1.int_struct_col.f1 = 10, t2.item = 1, t1.id = t2.pos
|
|
| |
|
|
| |--02:SINGULAR ROW SRC
|
|
| |
|
|
| 03:UNNEST [t1.int_array_col t2]
|
|
|
|
|
00:SCAN HDFS [functional.allcomplextypes t1]
|
|
partitions=0/0 files=0 size=0B
|
|
predicates: t1.int_struct_col.f1 = 10
|
|
predicates on t2: t2.item = 1
|
|
====
|
|
# IMPALA-2478: Test assignment of where-clause conjuncts with an outer-joined
|
|
# # correlated inline view.
|
|
select id from functional.allcomplextypes t1 left outer join
|
|
(select pos, item from t1.int_array_col t2) v
|
|
where t1.id > v.pos and v.item = 1
|
|
---- PLAN
|
|
PLAN-ROOT SINK
|
|
|
|
|
01:SUBPLAN
|
|
|
|
|
|--04:NESTED LOOP JOIN [RIGHT OUTER JOIN]
|
|
| | predicates: item = 1, t1.id > pos
|
|
| |
|
|
| |--02:SINGULAR ROW SRC
|
|
| |
|
|
| 03:UNNEST [t1.int_array_col t2]
|
|
|
|
|
00:SCAN HDFS [functional.allcomplextypes t1]
|
|
partitions=0/0 files=0 size=0B
|
|
predicates on t2: t2.item = 1
|
|
====
|
|
# IMPALA-2445: Test ordering of nested subplans.
|
|
select 1 from tpch_nested_parquet.customer c
|
|
left outer join c.c_orders o
|
|
# Has an ordering dependency on c and o
|
|
inner join o.o_lineitems
|
|
---- PLAN
|
|
PLAN-ROOT SINK
|
|
|
|
|
01:SUBPLAN
|
|
|
|
|
|--08:SUBPLAN
|
|
| |
|
|
| |--06:NESTED LOOP JOIN [CROSS JOIN]
|
|
| | |
|
|
| | |--04:SINGULAR ROW SRC
|
|
| | |
|
|
| | 05:UNNEST [o.o_lineitems]
|
|
| |
|
|
| 07:NESTED LOOP JOIN [RIGHT OUTER JOIN]
|
|
| |
|
|
| |--02:SINGULAR ROW SRC
|
|
| |
|
|
| 03:UNNEST [c.c_orders o]
|
|
|
|
|
00:SCAN HDFS [tpch_nested_parquet.customer c]
|
|
partitions=1/1 files=4 size=577.87MB
|
|
====
|
|
# IMPALA-3065/IMPALA-3062: Test correct assignment of !empty() predicates.
|
|
# Predicates should not be generated if the parent tuple is outer joined.
|
|
select 1 from tpch_nested_parquet.customer c1
|
|
inner join c1.c_orders
|
|
right outer join tpch_nested_parquet.customer c2
|
|
on c1.c_custkey = c2.c_custkey
|
|
---- PLAN
|
|
PLAN-ROOT SINK
|
|
|
|
|
06:HASH JOIN [RIGHT OUTER JOIN]
|
|
| hash predicates: c1.c_custkey = c2.c_custkey
|
|
| runtime filters: RF000 <- c2.c_custkey
|
|
|
|
|
|--05:SCAN HDFS [tpch_nested_parquet.customer c2]
|
|
| partitions=1/1 files=4 size=577.87MB
|
|
|
|
|
01:SUBPLAN
|
|
|
|
|
|--04:NESTED LOOP JOIN [CROSS JOIN]
|
|
| |
|
|
| |--02:SINGULAR ROW SRC
|
|
| |
|
|
| 03:UNNEST [c1.c_orders]
|
|
|
|
|
00:SCAN HDFS [tpch_nested_parquet.customer c1]
|
|
partitions=1/1 files=4 size=577.87MB
|
|
runtime filters: RF000 -> c1.c_custkey
|
|
====
|
|
# IMPALA-3065/IMPALA-3062: Test correct assignment of !empty() predicates.
|
|
# Predicates should not be generated if the parent tuple is outer joined.
|
|
select 1 from tpch_nested_parquet.customer c1
|
|
full outer join tpch_nested_parquet.customer c2
|
|
on c1.c_custkey = c2.c_custkey
|
|
inner join c1.c_orders o1
|
|
left semi join c2.c_orders o2
|
|
---- PLAN
|
|
PLAN-ROOT SINK
|
|
|
|
|
08:SUBPLAN
|
|
|
|
|
|--06:NESTED LOOP JOIN [LEFT SEMI JOIN]
|
|
| |
|
|
| |--04:UNNEST [c2.c_orders o2]
|
|
| |
|
|
| 05:NESTED LOOP JOIN [CROSS JOIN]
|
|
| |
|
|
| |--02:SINGULAR ROW SRC
|
|
| |
|
|
| 03:UNNEST [c1.c_orders o1]
|
|
|
|
|
07:HASH JOIN [FULL OUTER JOIN]
|
|
| hash predicates: c1.c_custkey = c2.c_custkey
|
|
|
|
|
|--01:SCAN HDFS [tpch_nested_parquet.customer c2]
|
|
| partitions=1/1 files=4 size=577.87MB
|
|
|
|
|
00:SCAN HDFS [tpch_nested_parquet.customer c1]
|
|
partitions=1/1 files=4 size=577.87MB
|
|
====
|
|
# IMPALA-3084: Test correct assignment of NULL checking predicates
|
|
# referencing outer-joined nested collections.
|
|
select * from tpch_nested_parquet.customer c
|
|
left outer join c.c_orders o
|
|
where o.o_orderkey is null and o.o_orderstatus <=> o_orderpriority
|
|
---- PLAN
|
|
PLAN-ROOT SINK
|
|
|
|
|
01:SUBPLAN
|
|
|
|
|
|--04:NESTED LOOP JOIN [RIGHT OUTER JOIN]
|
|
| | predicates: o.o_orderkey IS NULL, o.o_orderstatus IS NOT DISTINCT FROM o_orderpriority
|
|
| |
|
|
| |--02:SINGULAR ROW SRC
|
|
| |
|
|
| 03:UNNEST [c.c_orders o]
|
|
|
|
|
00:SCAN HDFS [tpch_nested_parquet.customer c]
|
|
partitions=1/1 files=4 size=577.87MB
|
|
====
|
|
# IMPALA-2540: Complex query mixing joins on base tables and nested collections.
|
|
select 1
|
|
from tpch_nested_parquet.region.r_nations t1
|
|
inner join tpch_nested_parquet.customer t2 on t2.c_nationkey = t1.pos
|
|
inner join tpch_nested_parquet.region t3 on t3.r_comment = t2.c_address
|
|
left join t2.c_orders t4
|
|
inner join tpch_nested_parquet.region t5 on t5.r_regionkey = t2.c_custkey
|
|
left join t4.item.o_lineitems t6 on t6.item.l_returnflag = t4.item.o_orderpriority
|
|
---- PLAN
|
|
PLAN-ROOT SINK
|
|
|
|
|
14:SUBPLAN
|
|
|
|
|
|--12:SUBPLAN
|
|
| |
|
|
| |--10:NESTED LOOP JOIN [RIGHT OUTER JOIN]
|
|
| | | join predicates: t6.item.l_returnflag = t4.item.o_orderpriority
|
|
| | |
|
|
| | |--08:SINGULAR ROW SRC
|
|
| | |
|
|
| | 09:UNNEST [t4.item.o_lineitems t6]
|
|
| |
|
|
| 11:NESTED LOOP JOIN [RIGHT OUTER JOIN]
|
|
| |
|
|
| |--06:SINGULAR ROW SRC
|
|
| |
|
|
| 07:UNNEST [t2.c_orders t4]
|
|
|
|
|
13:HASH JOIN [INNER JOIN]
|
|
| hash predicates: t1.pos = t2.c_nationkey
|
|
| runtime filters: RF000 <- t2.c_nationkey
|
|
|
|
|
|--05:HASH JOIN [INNER JOIN]
|
|
| | hash predicates: t3.r_comment = t2.c_address
|
|
| | runtime filters: RF001 <- t2.c_address
|
|
| |
|
|
| |--04:HASH JOIN [INNER JOIN]
|
|
| | | hash predicates: t2.c_custkey = t5.r_regionkey
|
|
| | | runtime filters: RF002 <- t5.r_regionkey
|
|
| | |
|
|
| | |--03:SCAN HDFS [tpch_nested_parquet.region t5]
|
|
| | | partitions=1/1 files=1 size=4.18KB
|
|
| | |
|
|
| | 01:SCAN HDFS [tpch_nested_parquet.customer t2]
|
|
| | partitions=1/1 files=4 size=577.87MB
|
|
| | runtime filters: RF002 -> t2.c_custkey
|
|
| |
|
|
| 02:SCAN HDFS [tpch_nested_parquet.region t3]
|
|
| partitions=1/1 files=1 size=4.18KB
|
|
| runtime filters: RF001 -> t3.r_comment
|
|
|
|
|
00:SCAN HDFS [tpch_nested_parquet.region.r_nations t1]
|
|
partitions=1/1 files=1 size=4.18KB
|
|
runtime filters: RF000 -> t1.pos
|
|
====
|