Files
impala/testdata/workloads/functional-planner/queries/PlannerTest/nested-loop-join.test
Henry Robinson 9f61397fc4 IMPALA-2905: Handle coordinator fragment lifecycle like all others
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>
2016-10-16 15:55:29 +00:00

217 lines
7.1 KiB
Plaintext

# Right outer joins with non-equi join predicates
select straight_join *
from functional.alltypestiny a right outer join functional.alltypes b
on a.id != b.id or a.int_col < b.int_col
right outer join functional.alltypesagg c
on a.smallint_col >= c.smallint_col
where a.id < 10 and c.bigint_col = 10
---- PLAN
PLAN-ROOT SINK
|
04:NESTED LOOP JOIN [RIGHT OUTER JOIN]
| join predicates: a.smallint_col >= c.smallint_col
| predicates: a.id < 10
|
|--02:SCAN HDFS [functional.alltypesagg c]
| partitions=11/11 files=11 size=814.73KB
| predicates: c.bigint_col = 10
|
03:NESTED LOOP JOIN [RIGHT OUTER JOIN]
| join predicates: a.id != b.id OR a.int_col < b.int_col
|
|--01:SCAN HDFS [functional.alltypes b]
| partitions=24/24 files=24 size=478.45KB
|
00:SCAN HDFS [functional.alltypestiny a]
partitions=4/4 files=4 size=460B
predicates: a.id < 10
---- DISTRIBUTEDPLAN
not implemented: Error generating a valid execution plan for this query. A RIGHT OUTER JOIN type with no equi-join predicates can only be executed with a single node plan.
====
# Right semi joins with non-equi join predicates
select straight_join *
from functional.alltypestiny a right semi join functional.alltypessmall c
on a.tinyint_col > c.tinyint_col
right semi join functional.alltypesagg d
on c.tinyint_col < d.bigint_col
where d.bigint_col < 10
---- PLAN
PLAN-ROOT SINK
|
04:NESTED LOOP JOIN [RIGHT SEMI JOIN]
| join predicates: c.tinyint_col < d.bigint_col
|
|--02:SCAN HDFS [functional.alltypesagg d]
| partitions=11/11 files=11 size=814.73KB
| predicates: d.bigint_col < 10
|
03:NESTED LOOP JOIN [RIGHT SEMI JOIN]
| join predicates: a.tinyint_col > c.tinyint_col
|
|--01:SCAN HDFS [functional.alltypessmall c]
| partitions=4/4 files=4 size=6.32KB
|
00:SCAN HDFS [functional.alltypestiny a]
partitions=4/4 files=4 size=460B
---- DISTRIBUTEDPLAN
not implemented: Error generating a valid execution plan for this query. A RIGHT SEMI JOIN type with no equi-join predicates can only be executed with a single node plan.
====
# Full outer joins with non-equi join predicates
select straight_join *
from functional.alltypestiny a full outer join functional.alltypessmall b
on a.id != b.id or a.int_col != b.int_col
full outer join functional.alltypesagg c
on a.tinyint_col > c.tinyint_col
full outer join functional.alltypes d
on c.int_col > d.int_col
where a.bigint_col != c.bigint_col and a.id < 10
---- PLAN
PLAN-ROOT SINK
|
06:NESTED LOOP JOIN [FULL OUTER JOIN]
| join predicates: c.int_col > d.int_col
| predicates: a.bigint_col != c.bigint_col, a.id < 10
|
|--03:SCAN HDFS [functional.alltypes d]
| partitions=24/24 files=24 size=478.45KB
|
05:NESTED LOOP JOIN [FULL OUTER JOIN]
| join predicates: a.tinyint_col > c.tinyint_col
|
|--02:SCAN HDFS [functional.alltypesagg c]
| partitions=11/11 files=11 size=814.73KB
|
04:NESTED LOOP JOIN [FULL OUTER JOIN]
| join predicates: a.id != b.id OR a.int_col != b.int_col
|
|--01:SCAN HDFS [functional.alltypessmall b]
| partitions=4/4 files=4 size=6.32KB
|
00:SCAN HDFS [functional.alltypestiny a]
partitions=4/4 files=4 size=460B
predicates: a.id < 10
---- DISTRIBUTEDPLAN
not implemented: Error generating a valid execution plan for this query. A FULL OUTER JOIN type with no equi-join predicates can only be executed with a single node plan.
====
# Right anti join with non-equi join predicates
select straight_join count(*)
from functional.alltypestiny a right anti join functional.alltypessmall b
on a.id < b.id
where b.int_col = 5
---- PLAN
PLAN-ROOT SINK
|
03:AGGREGATE [FINALIZE]
| output: count(*)
|
02:NESTED LOOP JOIN [RIGHT ANTI JOIN]
| join predicates: a.id < b.id
|
|--01:SCAN HDFS [functional.alltypessmall b]
| partitions=4/4 files=4 size=6.32KB
| predicates: b.int_col = 5
|
00:SCAN HDFS [functional.alltypestiny a]
partitions=4/4 files=4 size=460B
---- DISTRIBUTEDPLAN
not implemented: Error generating a valid execution plan for this query. A RIGHT ANTI JOIN type with no equi-join predicates can only be executed with a single node plan.
====
# Inner and right joins with non-equi join predicates
select straight_join count(*)
from functional.alltypestiny a inner join functional.alltypessmall b on a.id < b.id
right outer join functional.alltypesagg c on a.int_col != c.int_col
right semi join functional.alltypes d on c.tinyint_col < d.tinyint_col
right anti join functional.alltypesnopart e on d.tinyint_col > e.tinyint_col
where e.id < 10
---- PLAN
PLAN-ROOT SINK
|
09:AGGREGATE [FINALIZE]
| output: count(*)
|
08:NESTED LOOP JOIN [RIGHT ANTI JOIN]
| join predicates: d.tinyint_col > e.tinyint_col
|
|--04:SCAN HDFS [functional.alltypesnopart e]
| partitions=1/1 files=0 size=0B
| predicates: e.id < 10
|
07:NESTED LOOP JOIN [RIGHT SEMI JOIN]
| join predicates: c.tinyint_col < d.tinyint_col
|
|--03:SCAN HDFS [functional.alltypes d]
| partitions=24/24 files=24 size=478.45KB
|
06:NESTED LOOP JOIN [RIGHT OUTER JOIN]
| join predicates: a.int_col != c.int_col
|
|--02:SCAN HDFS [functional.alltypesagg c]
| partitions=11/11 files=11 size=814.73KB
|
05:NESTED LOOP JOIN [INNER JOIN]
| predicates: a.id < b.id
|
|--01:SCAN HDFS [functional.alltypessmall b]
| partitions=4/4 files=4 size=6.32KB
|
00:SCAN HDFS [functional.alltypestiny a]
partitions=4/4 files=4 size=460B
---- DISTRIBUTEDPLAN
not implemented: Error generating a valid execution plan for this query. A RIGHT ANTI JOIN type with no equi-join predicates can only be executed with a single node plan.
====
# Right semi and outer joins are inverted to make them executable.
# Same query as above but without the straight join hint.
select count(*)
from functional.alltypestiny a inner join functional.alltypessmall b on a.id < b.id
right outer join functional.alltypesagg c on a.int_col != c.int_col
right semi join functional.alltypes d on c.tinyint_col < d.tinyint_col
right anti join functional.alltypesnopart e on d.tinyint_col > e.tinyint_col
where e.id < 10
---- DISTRIBUTEDPLAN
PLAN-ROOT SINK
|
15:AGGREGATE [FINALIZE]
| output: count:merge(*)
|
14:EXCHANGE [UNPARTITIONED]
|
09:AGGREGATE
| output: count(*)
|
08:NESTED LOOP JOIN [LEFT ANTI JOIN, BROADCAST]
| join predicates: d.tinyint_col > e.tinyint_col
|
|--13:EXCHANGE [BROADCAST]
| |
| 07:NESTED LOOP JOIN [LEFT SEMI JOIN, BROADCAST]
| | join predicates: c.tinyint_col < d.tinyint_col
| |
| |--12:EXCHANGE [BROADCAST]
| | |
| | 06:NESTED LOOP JOIN [LEFT OUTER JOIN, BROADCAST]
| | | join predicates: a.int_col != c.int_col
| | |
| | |--11:EXCHANGE [BROADCAST]
| | | |
| | | 05:NESTED LOOP JOIN [INNER JOIN, BROADCAST]
| | | | predicates: a.id < b.id
| | | |
| | | |--10:EXCHANGE [BROADCAST]
| | | | |
| | | | 00:SCAN HDFS [functional.alltypestiny a]
| | | | partitions=4/4 files=4 size=460B
| | | |
| | | 01:SCAN HDFS [functional.alltypessmall b]
| | | partitions=4/4 files=4 size=6.32KB
| | |
| | 02:SCAN HDFS [functional.alltypesagg c]
| | partitions=11/11 files=11 size=814.73KB
| |
| 03:SCAN HDFS [functional.alltypes d]
| partitions=24/24 files=24 size=478.45KB
|
04:SCAN HDFS [functional.alltypesnopart e]
partitions=1/1 files=0 size=0B
predicates: e.id < 10
====