diff --git a/shims/0.23/pom.xml b/shims/0.23/pom.xml
index 2e16956..3b1fb97 100644
--- a/shims/0.23/pom.xml
+++ b/shims/0.23/pom.xml
@@ -61,7 +61,6 @@
org.apache.hadoop
hadoop-hdfs
${hadoop-23.version}
- true
org.apache.hadoop
diff --git a/shims/0.23/src/main/java/org/apache/hadoop/hive/shims/Hadoop23Shims.java b/shims/0.23/src/main/java/org/apache/hadoop/hive/shims/Hadoop23Shims.java
index 3292cb3..05100f8 100644
--- a/shims/0.23/src/main/java/org/apache/hadoop/hive/shims/Hadoop23Shims.java
+++ b/shims/0.23/src/main/java/org/apache/hadoop/hive/shims/Hadoop23Shims.java
@@ -531,13 +531,27 @@ public void setupConfiguration(Configuration conf) {
// else the updates do not get flushed properly
KeyProviderCryptoExtension keyProvider = miniDFSCluster.getNameNode().getNamesystem().getProvider();
if (keyProvider != null) {
- miniDFSCluster.getFileSystem().getClient().setKeyProvider(keyProvider);
+ try {
+ setKeyProvider(miniDFSCluster.getFileSystem().getClient(), keyProvider);
+ } catch (Exception err) {
+ throw new IOException(err);
+ }
}
cluster = new MiniDFSShim(miniDFSCluster);
return cluster;
}
+ private static void setKeyProvider(DFSClient dfsClient, KeyProviderCryptoExtension provider)
+ throws Exception {
+ if (setKeyProviderHadoop27Method != null) {
+ // Method signature changed in Hadoop 2.7. Cast provider to KeyProvider
+ setKeyProviderHadoop27Method.invoke(dfsClient, (KeyProvider) provider);
+ } else {
+ dfsClient.setKeyProvider(provider);
+ }
+ }
+
/**
* MiniDFSShim.
*
@@ -1021,6 +1035,7 @@ public void mergeCredentials(JobConf dest, JobConf src) throws IOException {
protected static final Method accessMethod;
protected static final Method getPasswordMethod;
+ protected static final Method setKeyProviderHadoop27Method;
static {
Method m = null;
@@ -1038,6 +1053,14 @@ public void mergeCredentials(JobConf dest, JobConf src) throws IOException {
m = null;
}
getPasswordMethod = m;
+
+ try {
+ m = DFSClient.class.getMethod("setKeyProvider", KeyProvider.class);
+ } catch (NoSuchMethodException err) {
+ // We can just use setKeyProvider() as it is
+ m = null;
+ }
+ setKeyProviderHadoop27Method = m;
}
@Override