HIVE-18824 : ValidWriteIdList config should be defined on tables which has to 
collect stats after insert (Sergey Shelukhin, reviewed by Eugene Koifman and 
Sankar Hariappan)


Project: http://git-wip-us.apache.org/repos/asf/hive/repo
Commit: http://git-wip-us.apache.org/repos/asf/hive/commit/a4198f58
Tree: http://git-wip-us.apache.org/repos/asf/hive/tree/a4198f58
Diff: http://git-wip-us.apache.org/repos/asf/hive/diff/a4198f58

Branch: refs/heads/master
Commit: a4198f584aa0792a16d1e1eeb2ef3147403b8acb
Parents: 5e3d85c
Author: sergey <ser...@apache.org>
Authored: Fri Mar 2 11:25:49 2018 -0800
Committer: sergey <ser...@apache.org>
Committed: Fri Mar 2 11:25:49 2018 -0800

----------------------------------------------------------------------
 ql/src/java/org/apache/hadoop/hive/ql/Driver.java | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hive/blob/a4198f58/ql/src/java/org/apache/hadoop/hive/ql/Driver.java
----------------------------------------------------------------------
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/Driver.java 
b/ql/src/java/org/apache/hadoop/hive/ql/Driver.java
index 94999fe..6999777 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/Driver.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/Driver.java
@@ -25,6 +25,7 @@ import java.io.PrintStream;
 import java.io.Serializable;
 import java.net.InetAddress;
 import java.util.ArrayList;
+import java.util.Collection;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.LinkedHashMap;
@@ -1244,15 +1245,18 @@ public class Driver implements IDriver {
 
   // Make the list of transactional tables list which are getting read or 
written by current txn
   private List<String> getTransactionalTableList(QueryPlan plan) {
-    List<String> tableList = new ArrayList<>();
+    Set<String> tableList = new HashSet<>();
 
     for (ReadEntity input : plan.getInputs()) {
       addTableFromEntity(input, tableList);
     }
-    return tableList;
+    for (WriteEntity output : plan.getOutputs()) {
+      addTableFromEntity(output, tableList);
+    }
+    return new ArrayList<String>(tableList);
   }
 
-  private void addTableFromEntity(Entity entity, List<String> tableList) {
+  private void addTableFromEntity(Entity entity, Collection<String> tableList) 
{
     Table tbl;
     switch (entity.getType()) {
       case TABLE: {
@@ -1268,10 +1272,9 @@ public class Driver implements IDriver {
         return;
       }
     }
+    if (!AcidUtils.isTransactionalTable(tbl)) return;
     String fullTableName = AcidUtils.getFullTableName(tbl.getDbName(), 
tbl.getTableName());
-    if (AcidUtils.isTransactionalTable(tbl) && 
!tableList.contains(fullTableName)) {
-      tableList.add(fullTableName);
-    }
+    tableList.add(fullTableName);
   }
 
   private String getUserFromUGI() {

Reply via email to