diff --git a/metastore/bin/.gitignore b/metastore/bin/.gitignore deleted file mode 100644 index 0dd9890..0000000 --- a/metastore/bin/.gitignore +++ /dev/null @@ -1 +0,0 @@ -# Dummy file to make Git recognize this empty directory diff --git a/service/src/java/org/apache/hive/service/cli/thrift/ThriftCLIService.java b/service/src/java/org/apache/hive/service/cli/thrift/ThriftCLIService.java index 058e108..562ac07 100644 --- a/service/src/java/org/apache/hive/service/cli/thrift/ThriftCLIService.java +++ b/service/src/java/org/apache/hive/service/cli/thrift/ThriftCLIService.java @@ -30,7 +30,10 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.hadoop.hive.conf.HiveConf; +import org.apache.hadoop.hive.conf.HiveConfUtil; import org.apache.hadoop.hive.conf.HiveConf.ConfVars; +import org.apache.hadoop.hive.ql.metadata.Hive; +import org.apache.hadoop.hive.ql.metadata.HiveException; import org.apache.hive.service.AbstractService; import org.apache.hive.service.ServiceException; import org.apache.hive.service.ServiceUtils; @@ -351,9 +354,21 @@ private String getDelegationToken(String userName) return null; } try { + String msUri = Hive.get(cliService.getHiveConf()). + getMSC().getConfigValue(HiveConf.ConfVars.METASTOREURIS.varname, null); + + if (msUri != null && HiveConfUtil.isEmbeddedMetaStore(msUri)) { + if (LOG.isDebugEnabled()) { + LOG.debug("getDelegationToken() canot be called on local mode"); + } + return null; + } return cliService.getDelegationTokenFromMetaStore(userName); - } catch (UnsupportedOperationException e) { + } catch (UnsupportedOperationException | TException | HiveException e) { // The delegation token is not applicable in the given deployment mode + if (LOG.isDebugEnabled()) { + LOG.debug("Unable to get delegation token from metastore : " + e.getMessage()); + } } return null; }