hive-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hashut...@apache.org
Subject svn commit: r1364853 - in /hive/trunk/ql/src: java/org/apache/hadoop/hive/ql/Driver.java test/queries/clientnegative/join_nonexistent_part.q test/results/clientnegative/join_nonexistent_part.q.out
Date Tue, 24 Jul 2012 00:18:05 GMT
Author: hashutosh
Date: Tue Jul 24 00:18:04 2012
New Revision: 1364853

URL: http://svn.apache.org/viewvc?rev=1364853&view=rev
Log:
HIVE-3225 : NPE on a join query with authorization enabled (Francis Liu via Ashutosh Chauhan)

Added:
    hive/trunk/ql/src/test/queries/clientnegative/join_nonexistent_part.q
    hive/trunk/ql/src/test/results/clientnegative/join_nonexistent_part.q.out
Modified:
    hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/Driver.java

Modified: hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/Driver.java
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/Driver.java?rev=1364853&r1=1364852&r2=1364853&view=diff
==============================================================================
--- hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/Driver.java (original)
+++ hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/Driver.java Tue Jul 24 00:18:04 2012
@@ -606,7 +606,11 @@ public class Driver implements CommandPr
                 cols.add(columns.get(i).getName());
               }
             }
-            if (tbl.isPartitioned() && tableUsePartLevelAuth.get(tbl.getTableName()))
{
+            //map may not contain all sources, since input list may have been optimized out
+            //or non-existent tho such sources may still be referenced by the TableScanOperator
+            //if it's null then the partition probably doesn't exist so let's use table permission
+            if (tbl.isPartitioned() &&
+                tableUsePartLevelAuth.get(tbl.getTableName()) == Boolean.TRUE) {
               String alias_id = topOpMap.getKey();
               PrunedPartitionList partsList = PartitionPruner.prune(parseCtx
                   .getTopToTable().get(topOp), parseCtx.getOpToPartPruner()
@@ -643,7 +647,7 @@ public class Driver implements CommandPr
         if (read.getPartition() != null) {
           tbl = read.getPartition().getTable();
           // use partition level authorization
-          if (tableUsePartLevelAuth.get(tbl.getTableName())) {
+          if (tableUsePartLevelAuth.get(tbl.getTableName()) == Boolean.TRUE) {
             List<String> cols = part2Cols.get(read.getPartition());
             if (cols != null && cols.size() > 0) {
               ss.getAuthorizer().authorize(read.getPartition().getTable(),

Added: hive/trunk/ql/src/test/queries/clientnegative/join_nonexistent_part.q
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/test/queries/clientnegative/join_nonexistent_part.q?rev=1364853&view=auto
==============================================================================
--- hive/trunk/ql/src/test/queries/clientnegative/join_nonexistent_part.q (added)
+++ hive/trunk/ql/src/test/queries/clientnegative/join_nonexistent_part.q Tue Jul 24 00:18:04
2012
@@ -0,0 +1,4 @@
+SET hive.security.authorization.enabled = true;
+SELECT *
+FROM srcpart s1 join src s2 on s1.key == s2.key
+WHERE s1.ds='non-existent';
\ No newline at end of file

Added: hive/trunk/ql/src/test/results/clientnegative/join_nonexistent_part.q.out
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/test/results/clientnegative/join_nonexistent_part.q.out?rev=1364853&view=auto
==============================================================================
--- hive/trunk/ql/src/test/results/clientnegative/join_nonexistent_part.q.out (added)
+++ hive/trunk/ql/src/test/results/clientnegative/join_nonexistent_part.q.out Tue Jul 24 00:18:04
2012
@@ -0,0 +1 @@
+Authorization failed:No privilege 'Select' found for inputs { database:default, table:src,
columnName:key}. Use show grant to get more details.



Mime
View raw message