[
https://issues.apache.org/jira/browse/IMPALA-8954?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17157023#comment-17157023
]
ASF subversion and git services commented on IMPALA-8954:
---------------------------------------------------------
Commit 4e2498da6f94a8da78a077bb9e44ff85a66523d0 in impala's branch
refs/heads/master from Tim Armstrong
[ https://gitbox.apache.org/repos/asf?p=impala.git;h=4e2498d ]
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 <[email protected]>
Tested-by: Impala Public Jenkins <[email protected]>
> Support uncorrelated subqueries in the select list
> --------------------------------------------------
>
> Key: IMPALA-8954
> URL: https://issues.apache.org/jira/browse/IMPALA-8954
> Project: IMPALA
> Issue Type: Sub-task
> Components: Frontend
> Affects Versions: Impala 3.3.0
> Reporter: Tim Armstrong
> Assignee: Shant Hovsepian
> Priority: Critical
> Labels: sql-language, tpc-ds
> Fix For: Impala 4.0
>
>
> {noformat}
> [localhost:21000] default> select 'foo', (select 'bar');
> Query: select 'foo', (select 'bar')
> Query submitted at: 2019-09-18 13:44:43 (Coordinator:
> http://tarmstrong-box:25000)
> ERROR: AnalysisException: Subqueries are not supported in the select list.
> {noformat}
> I think we can support these, implemented as a nested loop join with a
> cardinality check node if needed.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]