You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by yc...@apache.org on 2017/05/16 18:03:37 UTC
hive git commit: HIVE-16660: Not able to add partition for views in
hive when sentry is enabled (Yongzhi Chen, reviewed by Aihua Xu)
Repository: hive
Updated Branches:
refs/heads/master 2bcbd29e8 -> 6e0c52e68
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/master
Commit: 6e0c52e6883cb55de3b8557504c13f3c8dfb619f
Parents: 2bcbd29
Author: Yongzhi Chen <yc...@apache.org>
Authored: Fri May 12 10:06:04 2017 -0400
Committer: Yongzhi Chen <yc...@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());