hive-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From w...@apache.org
Subject [49/50] [abbrv] hive git commit: HIVE-16660: Not able to add partition for views in hive when sentry is enabled (Yongzhi Chen, reviewed by Aihua Xu)
Date Wed, 17 May 2017 02:53:27 GMT
HIVE-16660: Not able to add partition for views in hive when sentry is enabled (Yongzhi Chen,
reviewed by Aihua Xu)


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

Branch: refs/heads/hive-14535
Commit: 6e0c52e6883cb55de3b8557504c13f3c8dfb619f
Parents: 2bcbd29
Author: Yongzhi Chen <ychena@apache.org>
Authored: Fri May 12 10:06:04 2017 -0400
Committer: Yongzhi Chen <ychena@apache.org>
Committed: Tue May 16 13:53:33 2017 -0400

----------------------------------------------------------------------
 .../org/apache/hadoop/hive/ql/metadata/Partition.java     | 10 ++++++++--
 .../apache/hadoop/hive/ql/parse/DDLSemanticAnalyzer.java  |  4 +++-
 2 files changed, 11 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hive/blob/6e0c52e6/ql/src/java/org/apache/hadoop/hive/ql/metadata/Partition.java
----------------------------------------------------------------------
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/metadata/Partition.java b/ql/src/java/org/apache/hadoop/hive/ql/metadata/Partition.java
index bff1688..75179ab 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/metadata/Partition.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/metadata/Partition.java
@@ -213,9 +213,15 @@ public class Partition implements Serializable {
 
   public Path getDataLocation() {
     if (table.isPartitioned()) {
-      return new Path(tPartition.getSd().getLocation());
+      if (tPartition.getSd() == null)
+        return null;
+      else
+        return new Path(tPartition.getSd().getLocation());
     } else {
-      return new Path(table.getTTable().getSd().getLocation());
+      if (table.getTTable() == null || table.getTTable().getSd() == null)
+        return null;
+      else
+        return new Path(table.getTTable().getSd().getLocation());
     }
   }
 

http://git-wip-us.apache.org/repos/asf/hive/blob/6e0c52e6/ql/src/java/org/apache/hadoop/hive/ql/parse/DDLSemanticAnalyzer.java
----------------------------------------------------------------------
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/parse/DDLSemanticAnalyzer.java b/ql/src/java/org/apache/hadoop/hive/ql/parse/DDLSemanticAnalyzer.java
index 77bc12c..7601267 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/parse/DDLSemanticAnalyzer.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/parse/DDLSemanticAnalyzer.java
@@ -2934,7 +2934,9 @@ public class DDLSemanticAnalyzer extends BaseSemanticAnalyzer {
         }
         cmd.append(")");
       }
-      Driver driver = new Driver(conf);
+      SessionState ss = SessionState.get();
+      String uName = (ss == null? null: ss.getUserName());
+      Driver driver = new Driver(conf, uName);
       int rc = driver.compile(cmd.toString(), false);
       if (rc != 0) {
         throw new SemanticException(ErrorMsg.NO_VALID_PARTN.getMsg());


Mime
View raw message