Files
impala/testdata/workloads/functional-query/queries/QueryTest
Tim Armstrong 4e2498da6f IMPALA-9949: fix SELECT list subqueries with HAVING/LIMIT
The patch for IMPALA-8954 failed to account for subqueries
that could produce < 1 row. SelectStmt.returnsSingleRow()
is confusing because it actually returns true if it
returns *at most* one row.

As a fix I split it into returnsExactlyOneRow() and
returnsAtMostOneRow(), then used returnsExactlyOneRow()
to determine if the subquery should instead be rewritten
into a LEFT OUTER JOIN, which produces the correct result.

CROSS JOIN is still preferred because it can be more freely
reordered during planning.

Testing:
* Added planner tests for a range of scenarios where it can
  be rewritten as a CROSS JOIN and where it needs to be a LEFT
  OUTER JOIN for correctness.
* Added some targeted end-to-end tests where the results were
  previously incorrect. Checked the behaviour against Hive and
  postgres.

Ran exhaustive tests.

Change-Id: I6034aedac776783bdc8cdb3a2df344e2b3662da6
Reviewed-on: http://gerrit.cloudera.org:8080/16171
Reviewed-by: Tim Armstrong <tarmstrong@cloudera.com>
Tested-by: Impala Public Jenkins <impala-public-jenkins@cloudera.com>
2020-07-13 22:38:36 +00:00
..
2014-06-20 13:35:10 -07:00