[
https://issues.apache.org/jira/browse/HIVE-784?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13798696#comment-13798696
]
Phabricator commented on HIVE-784:
----------------------------------
hbutani has commented on the revision "HIVE-784 [jira] Support uncorrelated
subqueries in the WHERE clause".
Tried to address all the issues you raised, except for the Nested SubQuery
check. In addition:
- added a bunch of -ve tests: subquery with or, check for exists/not exists
with implicit Group By, subquery with multiple columns in select
INLINE COMMENTS
ql/src/java/org/apache/hadoop/hive/ql/parse/IdentifiersParser.g:391 Changed
the grammar so we support both these forms:
select ...
from ...
where x not in (select ...)
or
select...
from ...
where not x in (select ...)
ql/src/java/org/apache/hadoop/hive/ql/parse/QBSubQuery.java:470 this is
checking the where clause in the SubQuery.
It can be null. When it is null, it implies this is an uncorrelated SubQuery.
ql/src/java/org/apache/hadoop/hive/ql/parse/QBSubQuery.java:496 yes this is
allowed. Works in mysql. Can look into this in a later jira
ql/src/java/org/apache/hadoop/hive/ql/parse/QBSubQuery.java:537
sqNewSarchCond can be null. In case there is only 1 conjunct, no copy is made.
ASTNode equals doesn't do a deep check.
ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java:1804 No
this feature is missing. Can this be a separate jira
ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java:6526 i
looked at this again:
- the initial switch is different, because this method is based on
subQuery.joinType
- the way the left and right aliases are setup is different.
- the code for initializing expressions,filters and filterFrPushing can be
refactored out. Doesn't seem worth it though.
ql/src/java/org/apache/hadoop/hive/ql/parse/SubQueryUtils.java:101 this gets
caught in the remove method below, because then the SubQuery is not a top level
conjunct.
Have added a -ve test for this.
ql/src/java/org/apache/hadoop/hive/ql/parse/SubQueryUtils.java:226-233 this
method differs from SemanticAnalyzer::doPhase1GetAllAggregations in:
- doesn't throw SemanticException
- doesn't pass the ASTNode to the UnparseTranslator.
- returns an int instead of the Agg/Windowing ASTNodes
REVISION DETAIL
https://reviews.facebook.net/D13443
To: JIRA, ashutoshc, hbutani
> Support uncorrelated subqueries in the WHERE clause
> ---------------------------------------------------
>
> Key: HIVE-784
> URL: https://issues.apache.org/jira/browse/HIVE-784
> Project: Hive
> Issue Type: New Feature
> Components: Query Processor
> Reporter: Ning Zhang
> Assignee: Harish Butani
> Attachments: D13443.1.patch, D13443.2.patch, HIVE-784.1.patch.txt,
> HIVE-784.2.patch, SubQuerySpec.pdf, tpchQueriesUsingSubQueryClauses.sql
>
>
> Hive currently only support views in the FROM-clause, some Facebook use cases
> suggest that Hive should support subqueries such as those connected by
> IN/EXISTS in the WHERE-clause.
--
This message was sent by Atlassian JIRA
(v6.1#6144)