deniskuzZ commented on code in PR #6685:
URL: https://github.com/apache/hive/pull/6685#discussion_r4468614649


##########
ql/src/java/org/apache/hadoop/hive/ql/parse/MergeSemanticAnalyzer.java:
##########
@@ -131,7 +133,21 @@ WHEN NOT MATCHED THEN INSERT VALUES (source.a2, source.b2)
         .sourceName(sourceName)
         .sourceAlias(getSourceAlias(source, sourceName))
         .onClauseAsText(onClauseAsText);
-
+     
+    OnClauseAnalyzer oca = new OnClauseAnalyzer(onClause, targetTable, 
targetAlias,

Review Comment:
   Moving oca.analyze() out of the TOK_INSERT branch makes it run for every 
MERGE, on all table types, not only COW. visit() throws 
IllegalArgumentException for nested DOT refs, and a struct field access in ON 
produces exactly that AST. So e.g. MERGE INTO tgt t USING src s ON t.info.id = 
s.id WHEN MATCHED THEN UPDATE ... would now fail even on ACID/MOR tables, where 
it previously compiled. 
   
   Please keep analyze() scoped to the insert branch. If the COW guard needs 
the unqualified columns, collect them separately, and handle DOT(DOT(...)) in 
visit(). A test with a struct column in the ON clause would be good too.



-- 
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]

Reply via email to