--- hbase-handler/src/java/org/apache/hadoop/hive/hbase/HBaseStorageHandler.java 2014-03-04 18:19:28.000000000 -0700 +++ hbase-handler/src/java/org/apache/hadoop/hive/hbase/HBaseStorageHandler.java 2014-05-02 16:40:20.000000000 -0700 @@ -392,6 +392,12 @@ TableMapReduceUtil.addDependencyJars(copy); merged.addAll(copy.getConfiguration().getStringCollection("tmpjars")); jobConf.set("tmpjars", StringUtils.arrayToString(merged.toArray(new String[0]))); + + // Get credentials using the configuration instance which has HBase properties + JobConf hbaseJobConf = new JobConf(getConf()); + org.apache.hadoop.hbase.mapred.TableMapReduceUtil.initCredentials(hbaseJobConf); + jobConf.getCredentials().mergeAll(hbaseJobConf.getCredentials()); + } catch (IOException e) { throw new RuntimeException(e); } --- hbase-handler/src/java/org/apache/hadoop/hive/hbase/HiveHBaseTableInputFormat.java 2014-03-24 08:31:46.000000000 -0700 +++ hbase-handler/src/java/org/apache/hadoop/hive/hbase/HiveHBaseTableInputFormat.java 2014-05-02 16:41:53.000000000 -0700 @@ -69,6 +69,7 @@ import org.apache.hadoop.mapreduce.JobContext; import org.apache.hadoop.mapreduce.TaskAttemptContext; import org.apache.hadoop.mapreduce.lib.input.FileInputFormat; +import org.apache.hadoop.security.UserGroupInformation; /** * HiveHBaseTableInputFormat implements InputFormat for HBase storage handler @@ -412,7 +413,9 @@ public InputSplit[] getSplits(JobConf jobConf, int numSplits) throws IOException { //obtain delegation tokens for the job - TableMapReduceUtil.initCredentials(jobConf); + if (UserGroupInformation.getCurrentUser().hasKerberosCredentials()) { + TableMapReduceUtil.initCredentials(jobConf); + } String hbaseTableName = jobConf.get(HBaseSerDe.HBASE_TABLE_NAME); setHTable(new HTable(HBaseConfiguration.create(jobConf), Bytes.toBytes(hbaseTableName))); --- hbase-handler/src/java/org/apache/hadoop/hive/hbase/HiveHBaseTableOutputFormat.java 2014-03-04 18:19:28.000000000 -0700 +++ hbase-handler/src/java/org/apache/hadoop/hive/hbase/HiveHBaseTableOutputFormat.java 2014-05-02 16:41:53.000000000 -0700 @@ -42,6 +42,7 @@ import org.apache.hadoop.mapreduce.OutputCommitter; import org.apache.hadoop.mapreduce.TaskAttemptContext; import org.apache.hadoop.util.Progressable; +import org.apache.hadoop.security.UserGroupInformation; /** * HiveHBaseTableOutputFormat implements HiveOutputFormat for HBase tables. @@ -72,7 +73,9 @@ public void checkOutputSpecs(FileSystem fs, JobConf jc) throws IOException { //obtain delegation tokens for the job - TableMapReduceUtil.initCredentials(jc); + if (UserGroupInformation.getCurrentUser().hasKerberosCredentials()) { + TableMapReduceUtil.initCredentials(jc); + } String hbaseTableName = jc.get(HBaseSerDe.HBASE_TABLE_NAME); jc.set(TableOutputFormat.OUTPUT_TABLE, hbaseTableName); --- ql/src/java/org/apache/hadoop/hive/ql/exec/tez/TezTask.java 2014-04-09 10:29:25.000000000 -0700 +++ ql/src/java/org/apache/hadoop/hive/ql/exec/tez/TezTask.java 2014-05-02 16:40:20.000000000 -0700 @@ -50,6 +50,7 @@ import org.apache.hadoop.hive.ql.plan.api.StageType; import org.apache.hadoop.hive.ql.session.SessionState; import org.apache.hadoop.mapred.JobConf; +import org.apache.hadoop.security.token.Token; import org.apache.hadoop.util.StringUtils; import org.apache.hadoop.yarn.api.records.LocalResource; import org.apache.tez.client.TezSession; @@ -213,6 +214,7 @@ // the name of the dag is what is displayed in the AM/Job UI DAG dag = new DAG(work.getName()); + dag.setCredentials(conf.getCredentials()); for (BaseWork w: ws) {