hive-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From khorg...@apache.org
Subject hive git commit: HIVE-12875 : Verify sem.getInputs() and sem.getOutputs() (Sushanth Sowmyan, reviewed by Alan Gates)
Date Mon, 18 Jan 2016 21:30:53 GMT
Repository: hive
Updated Branches:
  refs/heads/branch-1.1 07f49d4d1 -> 2efade3c7


HIVE-12875 : Verify sem.getInputs() and sem.getOutputs() (Sushanth Sowmyan, reviewed by Alan
Gates)


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

Branch: refs/heads/branch-1.1
Commit: 2efade3c70eb4511bdbb75b5bd202cec0ea1d493
Parents: 07f49d4
Author: Sushanth Sowmyan <khorgath@gmail.com>
Authored: Mon Jan 18 13:23:26 2016 -0800
Committer: Sushanth Sowmyan <khorgath@gmail.com>
Committed: Mon Jan 18 13:29:06 2016 -0800

----------------------------------------------------------------------
 .../java/org/apache/hadoop/hive/ql/Driver.java  | 26 ++++++++++++++++----
 1 file changed, 21 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hive/blob/2efade3c/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 ef6db3a..a00abb9 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/Driver.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/Driver.java
@@ -33,6 +33,7 @@ import java.util.Map;
 import java.util.Queue;
 import java.util.Set;
 
+import com.google.common.collect.Sets;
 import org.apache.commons.lang.StringUtils;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
@@ -548,12 +549,27 @@ public class Driver implements CommandProcessor {
    */
   public static void doAuthorization(BaseSemanticAnalyzer sem, String command)
       throws HiveException, AuthorizationException {
-    HashSet<ReadEntity> inputs = sem.getInputs();
-    HashSet<WriteEntity> outputs = sem.getOutputs();
     SessionState ss = SessionState.get();
     HiveOperation op = ss.getHiveOperation();
     Hive db = sem.getDb();
 
+    Set<ReadEntity> additionalInputs = new HashSet<ReadEntity>();
+    for (Entity e : sem.getInputs()) {
+      if (e.getType() == Entity.Type.PARTITION) {
+        additionalInputs.add(new ReadEntity(e.getTable()));
+      }
+    }
+
+    Set<WriteEntity> additionalOutputs = new HashSet<WriteEntity>();
+    for (Entity e : sem.getOutputs()) {
+      if (e.getType() == Entity.Type.PARTITION) {
+        additionalOutputs.add(new WriteEntity(e.getTable(), WriteEntity.WriteType.DDL_NO_LOCK));
+      }
+    }
+
+    Set<ReadEntity> inputs = Sets.union(sem.getInputs(), additionalInputs);
+    Set<WriteEntity> outputs = Sets.union(sem.getOutputs(), additionalOutputs);
+
     if (ss.isAuthorizationModeV2()) {
       // get mapping of tables to columns used
       ColumnAccessInfo colAccessInfo = sem.getColumnAccessInfo();
@@ -750,8 +766,8 @@ public class Driver implements CommandProcessor {
 
   }
 
-  private static void doAuthorizationV2(SessionState ss, HiveOperation op, HashSet<ReadEntity>
inputs,
-      HashSet<WriteEntity> outputs, String command, Map<String, List<String>>
tab2cols,
+  private static void doAuthorizationV2(SessionState ss, HiveOperation op, Set<ReadEntity>
inputs,
+      Set<WriteEntity> outputs, String command, Map<String, List<String>>
tab2cols,
       Map<String, List<String>> updateTab2Cols) throws HiveException {
 
     /* comment for reviewers -> updateTab2Cols needed to be separate from tab2cols because
if I
@@ -771,7 +787,7 @@ public class Driver implements CommandProcessor {
   }
 
   private static List<HivePrivilegeObject> getHivePrivObjects(
-      HashSet<? extends Entity> privObjects, Map<String, List<String>>
tableName2Cols) {
+      Set<? extends Entity> privObjects, Map<String, List<String>> tableName2Cols)
{
     List<HivePrivilegeObject> hivePrivobjs = new ArrayList<HivePrivilegeObject>();
     if(privObjects == null){
       return hivePrivobjs;


Mime
View raw message