kasakrisz commented on code in PR #5781:
URL: https://github.com/apache/hive/pull/5781#discussion_r2074980905
##########
ql/src/java/org/apache/hadoop/hive/ql/Context.java:
##########
@@ -361,8 +361,16 @@ private DestClausePrefix getMergeDestClausePrefix(ASTNode
curNode) {
assert insert != null && insert.getType() == HiveParser.TOK_INSERT;
ASTNode query = (ASTNode) insert.getParent();
assert query != null && query.getType() == HiveParser.TOK_QUERY;
-
- int tokFromIdx =
query.getFirstChildWithType(HiveParser.TOK_FROM).getChildIndex();
+ ASTNode from = (ASTNode) query.getFirstChildWithType(HiveParser.TOK_FROM);
Review Comment:
In case of ACID we always use `merge on read` and the merge statement is
rewritten to a multi insert statement. In case of such statements only the from
clause (query clause, the merge and using clause of the merge) of the
statement is optimized by CBO. This is usually a query with a join of the
target and source tables. If the source is a query the plan can be more
complex. However the predicate causing the always empty result is in the when
matched clause of the merge (one of the insert branches of the multi insert) so
it doesn't appear in the CBO plan and we can't end up with a
`HiveValues(tuples=[[]])` CBO plan.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]