diff --git a/hbase-handler/src/java/org/apache/hadoop/hive/hbase/HBaseStorageHandler.java b/hbase-handler/src/java/org/apache/hadoop/hive/hbase/HBaseStorageHandler.java index 4fe1b1b..0d799e3 100644 --- a/hbase-handler/src/java/org/apache/hadoop/hive/hbase/HBaseStorageHandler.java +++ b/hbase-handler/src/java/org/apache/hadoop/hive/hbase/HBaseStorageHandler.java @@ -72,7 +72,7 @@ //Check if the configure job properties is called from input // or output for setting asymmetric properties - private boolean configureInputJobProps = true; + private boolean configureOutputJobProps = false; private Configuration jobConf; private Configuration hbaseConf; @@ -275,7 +275,7 @@ public void configureInputJobProperties( TableDesc tableDesc, Map jobProperties) { //Input - this.configureInputJobProps = true; + this.configureOutputJobProps = false; configureTableJobProperties(tableDesc, jobProperties); } @@ -284,7 +284,7 @@ public void configureOutputJobProperties( TableDesc tableDesc, Map jobProperties) { //Output - this.configureInputJobProps = false; + this.configureOutputJobProps = true; configureTableJobProperties(tableDesc, jobProperties); } @@ -331,21 +331,27 @@ public void configureTableJobProperties( addHBaseResources(jobConf, jobProperties); // do this for reconciling HBaseStorageHandler for use in HCatalog - // check to see if this an input job or an outputjob - if (this.configureInputJobProps) { + // check to see if this an input job or an outputjob. + if (this.configureOutputJobProps) { + // HCatalog output job + jobProperties.put(TableOutputFormat.OUTPUT_TABLE, tableName); + } else { + // HCatalog input job or default (per hive) for (String k : jobProperties.keySet()) { jobConf.set(k, jobProperties.get(k)); } try { + // Note : This is not needed for the output side from HCatalog, since + // HCatalog will make sure to call checkOutputSpecs on the underlying + // OF, which initializes credentials. This is thus needed only for the + // input side from within HCatalog. It is also needed for regular + // operation of hive. addHBaseDelegationToken(jobConf); }//try catch (IOException e) { throw new IllegalStateException("Error while configuring input job properties", e); } //input job properties } - else { - jobProperties.put(TableOutputFormat.OUTPUT_TABLE, tableName); - } // output job properties } /**