konstantinb commented on code in PR #6423:
URL: https://github.com/apache/hive/pull/6423#discussion_r3227827776


##########
ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java:
##########
@@ -1568,7 +1569,7 @@ Table materializeCTE(String cteName, CTEClause cte) 
throws HiveException {
     createTable.addChild(temporary);
     createTable.addChild(cte.cteNode);
 
-    SemanticAnalyzer analyzer = new SemanticAnalyzer(queryState);
+    SemanticAnalyzer analyzer = (SemanticAnalyzer) 
DDLSemanticAnalyzerFactory.getAnalyzer(createTable, queryState);

Review Comment:
   > is this a safe cast?
   
   Yes — for TOK_CREATETABLE, the factory returns CreateTableAnalyzer, which 
extends CalcitePlanner → SemanticAnalyzer. The token type is set at the top of 
the same method (materializeCTE), making the cast deterministic. A similar 
pattern is used in AbstractCreateViewAnalyzer, AlterTableExecuteAnalyzer, and 
ExplainSQRewriteSemanticAnalyzer.



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