diff --git a/itests/hive-unit-hadoop2/src/test/java/org/apache/hadoop/hive/thrift/TestHadoop20SAuthBridge.java b/itests/hive-unit-hadoop2/src/test/java/org/apache/hadoop/hive/thrift/TestHadoop20SAuthBridge.java index f6029b1..84af343 100644 --- a/itests/hive-unit-hadoop2/src/test/java/org/apache/hadoop/hive/thrift/TestHadoop20SAuthBridge.java +++ b/itests/hive-unit-hadoop2/src/test/java/org/apache/hadoop/hive/thrift/TestHadoop20SAuthBridge.java @@ -374,11 +374,10 @@ public HiveMetaStoreClient run() throws Exception { //over kerberos boolean pass = false; try { - hiveClient.getDelegationToken(clientUgi.getUserName()); + pass = hiveClient.getDelegationToken(clientUgi.getUserName()) == null; } catch (MetaException ex) { - pass = true; } - assertTrue("Expected the getDelegationToken call to fail", pass == true); + assertTrue("Expected the getDelegationToken call to return null", pass == true); hiveClient.close(); //Now cancel the delegation token diff --git a/metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStoreClient.java b/metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStoreClient.java index fdc9e91..eca1727 100644 --- a/metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStoreClient.java +++ b/metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStoreClient.java @@ -1787,9 +1787,9 @@ public String getDelegationToken(String renewerKerberosPrincipalName) throws @Override public String getDelegationToken(String owner, String renewerKerberosPrincipalName) throws MetaException, TException { - if(localMetaStore) { - throw new UnsupportedOperationException("getDelegationToken() can be " + - "called only in thrift (non local) mode"); + // This is expected to be a no-op, so we will return null when we use local metastore. + if (localMetaStore) { + return null; } return client.get_delegation_token(owner, renewerKerberosPrincipalName); } diff --git a/metastore/src/java/org/apache/hadoop/hive/metastore/IMetaStoreClient.java b/metastore/src/java/org/apache/hadoop/hive/metastore/IMetaStoreClient.java index 18c7675..92adad0 100644 --- a/metastore/src/java/org/apache/hadoop/hive/metastore/IMetaStoreClient.java +++ b/metastore/src/java/org/apache/hadoop/hive/metastore/IMetaStoreClient.java @@ -1088,6 +1088,8 @@ boolean revoke_privileges(PrivilegeBag privileges, boolean grantOption) throws MetaException, TException; /** + * This is expected to be a no-op when in local mode, + * which means that the implementation will return null. * @param owner the intended owner for the token * @param renewerKerberosPrincipalName * @return the string of the token