[ 
https://issues.apache.org/jira/browse/HIVE-21160?focusedWorklogId=777513&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-777513
 ]

ASF GitHub Bot logged work on HIVE-21160:
-----------------------------------------

                Author: ASF GitHub Bot
            Created on: 02/Jun/22 13:19
            Start Date: 02/Jun/22 13:19
    Worklog Time Spent: 10m 
      Work Description: kasakrisz commented on code in PR #2855:
URL: https://github.com/apache/hive/pull/2855#discussion_r887943205


##########
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 {
     switch (tree.getToken().getType()) {
     case HiveParser.TOK_DELETE_FROM:
-      analyzeDelete(tree);
+      analyzeDelete(tree, tabNameNode, table);
       break;
     case HiveParser.TOK_UPDATE_TABLE:
-      analyzeUpdate(tree);
+      analyzeUpdate(tree, tabNameNode, table);
       break;
     default:
       throw new RuntimeException("Asked to parse token " + tree.getName() + " 
in " +
           "UpdateDeleteSemanticAnalyzer");
     }
   }
 
-  private void analyzeUpdate(ASTNode tree) throws SemanticException {
+  private void analyzeUpdate(ASTNode tree, ASTNode tabNameNode, Table mTable) 
throws SemanticException {
     operation = Context.Operation.UPDATE;
-    reparseAndSuperAnalyze(tree);
+    boolean nonNativeAcid = AcidUtils.isNonNativeAcidTable(mTable);
+
+    if (HiveConf.getBoolVar(queryState.getConf(), 
HiveConf.ConfVars.SPLIT_UPDATE) && !nonNativeAcid) {
+      analyzeSplitUpdate(tree, mTable, tabNameNode);
+    } else {
+      reparseAndSuperAnalyze(tree, tabNameNode, mTable);

Review Comment:
   Altered the order to use everywhere `tree,mTable, tableNameNode`





Issue Time Tracking
-------------------

    Worklog Id:     (was: 777513)
    Time Spent: 4h 10m  (was: 4h)

> 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: 4h 10m
>  Remaining Estimate: 0h
>




--
This message was sent by Atlassian Jira
(v8.20.7#820007)

Reply via email to