[ https://issues.apache.org/jira/browse/HIVE-21160?focusedWorklogId=777504&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-777504 ]
ASF GitHub Bot logged work on HIVE-21160: ----------------------------------------- Author: ASF GitHub Bot Created on: 02/Jun/22 13:09 Start Date: 02/Jun/22 13:09 Worklog Time Spent: 10m Work Description: kasakrisz commented on code in PR #2855: URL: https://github.com/apache/hive/pull/2855#discussion_r887933328 ########## ql/src/java/org/apache/hadoop/hive/ql/parse/UpdateDeleteSemanticAnalyzer.java: ########## @@ -48,28 +52,43 @@ public class UpdateDeleteSemanticAnalyzer extends RewriteSemanticAnalyzer { super(queryState); } - protected void analyze(ASTNode tree) throws SemanticException { + @Override + protected ASTNode getTargetTableNode(ASTNode tree) { + // The first child should be the table we are updating / deleting from + ASTNode tabName = (ASTNode)tree.getChild(0); + assert tabName.getToken().getType() == HiveParser.TOK_TABNAME : + "Expected tablename as first child of " + operation + " but found " + tabName.getName(); + return tabName; + } + + protected void analyze(ASTNode tree, Table table, ASTNode tabNameNode) throws SemanticException { Review Comment: We need the quoted version of the db and table name. `TableName` object can't generate it when identifier contains `'` character because it does not escape the id but surround it with backticks. ``` public String getEscapedNotEmptyDbTable() { return db == null || db.trim().isEmpty() ? "`" + table + "`" : "`" + db + "`" + DatabaseName.CAT_DB_TABLE_SEPARATOR + "`" + table + "`"; } ``` Table object is good only in the update case. However the target table may have an alias defined in merge statements and we need that alias for the rewrite. It can be extracted from the `tabNameNode` AST. Issue Time Tracking ------------------- Worklog Id: (was: 777504) Time Spent: 3h 50m (was: 3h 40m) > Rewrite Update statement as Multi-insert and do Update split early > ------------------------------------------------------------------ > > Key: HIVE-21160 > URL: https://issues.apache.org/jira/browse/HIVE-21160 > Project: Hive > Issue Type: Sub-task > Components: Transactions > Affects Versions: 3.0.0 > Reporter: Eugene Koifman > Assignee: Krisztian Kasa > Priority: Major > Labels: pull-request-available > Time Spent: 3h 50m > Remaining Estimate: 0h > -- This message was sent by Atlassian Jira (v8.20.7#820007)