dengzhhu653 commented on code in PR #5440:
URL: https://github.com/apache/hive/pull/5440#discussion_r1756782996


##########
ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java:
##########
@@ -2138,11 +2138,12 @@ private int processQueryHint(ASTNode ast, QBParseInfo 
qbp, int posn) throws Sema
    */
   private void handleInsertStatementSpecPhase1(ASTNode ast, QBParseInfo qbp, 
Phase1Ctx ctx_1) throws SemanticException {
     ASTNode tabColName = (ASTNode)ast.getChild(1);
-    if(ast.getType() == HiveParser.TOK_INSERT_INTO && tabColName != null && 
tabColName.getType() == HiveParser.TOK_TABCOLNAME) {
+    boolean hasSpecificColumns = (tabColName != null && tabColName.getType() 
== HiveParser.TOK_TABCOLNAME);
+    if(ast.getType() == HiveParser.TOK_INSERT_INTO) {
       //we have "insert into foo(a,b)..."; parser will enforce that 1+ columns 
are listed if TOK_TABCOLNAME is present
       String fullTableName = getUnescapedName((ASTNode) 
ast.getChild(0).getChild(0),
           SessionState.get().getCurrentDatabase());
-      List<String> targetColumnNames = processTableColumnNames(tabColName, 
fullTableName);
+      List<String> targetColumnNames = hasSpecificColumns ? 
processTableColumnNames(tabColName, fullTableName) : new ArrayList<>();
       qbp.setDestSchemaForClause(ctx_1.dest, targetColumnNames);

Review Comment:
   should put `null` instead of `targetColumnNames` in case of `! 
hasSpecificColumns`?



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