You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by br...@apache.org on 2015/01/07 00:08:57 UTC
svn commit: r1649968 - in
/hive/branches/HIVE-8065/ql/src/java/org/apache/hadoop/hive/ql:
parse/SemanticAnalyzer.java session/SessionState.java
Author: brock
Date: Tue Jan 6 23:08:57 2015
New Revision: 1649968
URL: http://svn.apache.org/r1649968
Log:
HIVE-9265 - Hive with encryption throws NPE to fs path without schema (Chaoyu Tang via Brock)
Modified:
hive/branches/HIVE-8065/ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java
hive/branches/HIVE-8065/ql/src/java/org/apache/hadoop/hive/ql/session/SessionState.java
Modified: hive/branches/HIVE-8065/ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java
URL: http://svn.apache.org/viewvc/hive/branches/HIVE-8065/ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java?rev=1649968&r1=1649967&r2=1649968&view=diff
==============================================================================
--- hive/branches/HIVE-8065/ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java (original)
+++ hive/branches/HIVE-8065/ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java Tue Jan 6 23:08:57 2015
@@ -1844,7 +1844,7 @@ public class SemanticAnalyzer extends Ba
try {
if (strongestPath == null) {
strongestPath = tablePath;
- } else if (tablePath.toUri().getScheme().equals("hdfs")
+ } else if ("hdfs".equals(tablePath.toUri().getScheme())
&& isPathEncrypted(tablePath)
&& comparePathKeyStrength(tablePath, strongestPath) > 0)
{
@@ -1877,10 +1877,10 @@ public class SemanticAnalyzer extends Ba
// Looks for the most encrypted table location (if there is one)
tablePath = getStrongestEncryptedTablePath(qb);
- if (tablePath != null) {
+ if (tablePath != null && isPathEncrypted(tablePath)) {
// Only HDFS paths can be checked for encryption
- if (tablePath.toUri().getScheme().equals("hdfs")) {
- if (isPathReadOnly(tablePath) && isPathEncrypted(tablePath)) {
+ if ("hdfs".equals(tablePath.toUri().getScheme())) {
+ if (isPathReadOnly(tablePath)) {
Path tmpPath = ctx.getMRTmpPath();
if (comparePathKeyStrength(tablePath, tmpPath) < 0) {
throw new HiveException("Read-only encrypted tables cannot be read " +
@@ -1889,6 +1889,8 @@ public class SemanticAnalyzer extends Ba
stagingPath = tmpPath;
}
}
+ } else {
+ LOG.debug("Encryption is not applicable to table path " + tablePath.toString());
}
if (stagingPath == null) {
Modified: hive/branches/HIVE-8065/ql/src/java/org/apache/hadoop/hive/ql/session/SessionState.java
URL: http://svn.apache.org/viewvc/hive/branches/HIVE-8065/ql/src/java/org/apache/hadoop/hive/ql/session/SessionState.java?rev=1649968&r1=1649967&r2=1649968&view=diff
==============================================================================
--- hive/branches/HIVE-8065/ql/src/java/org/apache/hadoop/hive/ql/session/SessionState.java (original)
+++ hive/branches/HIVE-8065/ql/src/java/org/apache/hadoop/hive/ql/session/SessionState.java Tue Jan 6 23:08:57 2015
@@ -384,8 +384,10 @@ public class SessionState {
if (hdfsEncryptionShim == null) {
try {
FileSystem fs = FileSystem.get(conf);
- if (fs.getUri().getScheme().equals("hdfs")) {
+ if ("hdfs".equals(fs.getUri().getScheme())) {
hdfsEncryptionShim = ShimLoader.getHadoopShims().createHdfsEncryptionShim(fs, conf);
+ } else {
+ LOG.info("Could not get hdfsEncryptionShim, it is only applicable to hdfs filesystem.");
}
} catch (Exception e) {
throw new HiveException(e);