You are viewing a plain text version of this content. The canonical link for it is here.
Posted to hcatalog-commits@incubator.apache.org by ha...@apache.org on 2011/08/22 21:16:27 UTC
svn commit: r1160440 - in /incubator/hcatalog/trunk: CHANGES.txt
src/java/org/apache/hcatalog/mapreduce/HCatOutputFormat.java
src/java/org/apache/hcatalog/mapreduce/InitializeInput.java
src/java/org/apache/hcatalog/pig/PigHCatUtil.java
Author: hashutosh
Date: Mon Aug 22 21:16:27 2011
New Revision: 1160440
URL: http://svn.apache.org/viewvc?rev=1160440&view=rev
Log:
HCATALOG-53 HCatLoader, HCatStorer, HCatInputFormat, and HCatOutputFormat assume Hadoop running in secure mode
Modified:
incubator/hcatalog/trunk/CHANGES.txt
incubator/hcatalog/trunk/src/java/org/apache/hcatalog/mapreduce/HCatOutputFormat.java
incubator/hcatalog/trunk/src/java/org/apache/hcatalog/mapreduce/InitializeInput.java
incubator/hcatalog/trunk/src/java/org/apache/hcatalog/pig/PigHCatUtil.java
Modified: incubator/hcatalog/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/incubator/hcatalog/trunk/CHANGES.txt?rev=1160440&r1=1160439&r2=1160440&view=diff
==============================================================================
--- incubator/hcatalog/trunk/CHANGES.txt (original)
+++ incubator/hcatalog/trunk/CHANGES.txt Mon Aug 22 21:16:27 2011
@@ -61,6 +61,9 @@ Release 0.2.0 - Unreleased
OPTIMIZATIONS
BUG FIXES
+ HCAT-53. HCatLoader, HCatStorer, HCatInputFormat, and HCatOutputFormat assume Hadoop
+ running in secure mode (hashutosh)
+
HCAT-57. Remove usage of deprecated methods (hashutosh)
HCAT-59. Assimilate new changes in listener interface (hashutosh)
Modified: incubator/hcatalog/trunk/src/java/org/apache/hcatalog/mapreduce/HCatOutputFormat.java
URL: http://svn.apache.org/viewvc/incubator/hcatalog/trunk/src/java/org/apache/hcatalog/mapreduce/HCatOutputFormat.java?rev=1160440&r1=1160439&r2=1160440&view=diff
==============================================================================
--- incubator/hcatalog/trunk/src/java/org/apache/hcatalog/mapreduce/HCatOutputFormat.java (original)
+++ incubator/hcatalog/trunk/src/java/org/apache/hcatalog/mapreduce/HCatOutputFormat.java Mon Aug 22 21:16:27 2011
@@ -36,6 +36,7 @@ import org.apache.hadoop.fs.Path;
import org.apache.hadoop.fs.PathFilter;
import org.apache.hadoop.fs.permission.FsPermission;
import org.apache.hadoop.hive.conf.HiveConf;
+import org.apache.hadoop.hive.conf.HiveConf.ConfVars;
import org.apache.hadoop.hive.metastore.HiveMetaStoreClient;
import org.apache.hadoop.hive.metastore.api.FieldSchema;
import org.apache.hadoop.hive.metastore.api.MetaException;
@@ -417,11 +418,17 @@ public class HCatOutputFormat extends HC
if( url != null ) {
//User specified a thrift url
- hiveConf.setBoolean(HiveConf.ConfVars.METASTORE_USE_THRIFT_SASL.varname, true);
- hiveConf.set(HiveConf.ConfVars.METASTORE_KERBEROS_PRINCIPAL.varname, conf.get(HCatConstants.HCAT_METASTORE_PRINCIPAL));
-
hiveConf.set("hive.metastore.local", "false");
- hiveConf.set(HiveConf.ConfVars.METASTOREURIS.varname, url);
+ hiveConf.set(ConfVars.METASTOREURIS.varname, url);
+
+ String kerberosPrincipal = conf.get(HCatConstants.HCAT_METASTORE_PRINCIPAL);
+ if (kerberosPrincipal == null){
+ kerberosPrincipal = conf.get(ConfVars.METASTORE_KERBEROS_PRINCIPAL.varname);
+ }
+ if (kerberosPrincipal != null){
+ hiveConf.setBoolean(ConfVars.METASTORE_USE_THRIFT_SASL.varname, true);
+ hiveConf.set(ConfVars.METASTORE_KERBEROS_PRINCIPAL.varname, kerberosPrincipal);
+ }
if(conf.get(HCatConstants.HCAT_KEY_TOKEN_SIGNATURE) != null) {
hiveConf.set("hive.metastore.token.signature", conf.get(HCatConstants.HCAT_KEY_TOKEN_SIGNATURE));
}
Modified: incubator/hcatalog/trunk/src/java/org/apache/hcatalog/mapreduce/InitializeInput.java
URL: http://svn.apache.org/viewvc/incubator/hcatalog/trunk/src/java/org/apache/hcatalog/mapreduce/InitializeInput.java?rev=1160440&r1=1160439&r2=1160440&view=diff
==============================================================================
--- incubator/hcatalog/trunk/src/java/org/apache/hcatalog/mapreduce/InitializeInput.java (original)
+++ incubator/hcatalog/trunk/src/java/org/apache/hcatalog/mapreduce/InitializeInput.java Mon Aug 22 21:16:27 2011
@@ -51,15 +51,17 @@ public class InitializeInput {
private static final HiveConf hiveConf = new HiveConf(HCatInputFormat.class);
private static HiveMetaStoreClient createHiveMetaClient(Configuration conf, HCatTableInfo inputInfo) throws Exception {
- if (inputInfo.getServerUri() != null){
-
- hiveConf.setBoolean(HiveConf.ConfVars.METASTORE_USE_THRIFT_SASL.varname, true);
- hiveConf.set(HiveConf.ConfVars.METASTORE_KERBEROS_PRINCIPAL.varname,
- inputInfo.getServerKerberosPrincipal());
+ if (inputInfo.getServerUri() != null){
hiveConf.set("hive.metastore.local", "false");
hiveConf.set(HiveConf.ConfVars.METASTOREURIS.varname, inputInfo.getServerUri());
}
+
+ String kerberosPrincipal = inputInfo.getServerKerberosPrincipal();
+ if(kerberosPrincipal != null){
+ hiveConf.setBoolean(HiveConf.ConfVars.METASTORE_USE_THRIFT_SASL.varname, true);
+ hiveConf.set(HiveConf.ConfVars.METASTORE_KERBEROS_PRINCIPAL.varname, kerberosPrincipal);
+ }
return new HiveMetaStoreClient(hiveConf,null);
}
Modified: incubator/hcatalog/trunk/src/java/org/apache/hcatalog/pig/PigHCatUtil.java
URL: http://svn.apache.org/viewvc/incubator/hcatalog/trunk/src/java/org/apache/hcatalog/pig/PigHCatUtil.java?rev=1160440&r1=1160439&r2=1160440&view=diff
==============================================================================
--- incubator/hcatalog/trunk/src/java/org/apache/hcatalog/pig/PigHCatUtil.java (original)
+++ incubator/hcatalog/trunk/src/java/org/apache/hcatalog/pig/PigHCatUtil.java Mon Aug 22 21:16:27 2011
@@ -98,13 +98,15 @@ public class PigHCatUtil {
HiveConf hiveConf = new HiveConf(clazz);
if (serverUri != null){
-
- hiveConf.setBoolVar(HiveConf.ConfVars.METASTORE_USE_THRIFT_SASL, true);
- hiveConf.setVar(HiveConf.ConfVars.METASTORE_KERBEROS_PRINCIPAL, serverKerberosPrincipal);
-
hiveConf.set("hive.metastore.local", "false");
hiveConf.setVar(HiveConf.ConfVars.METASTOREURIS, serverUri.trim());
}
+
+ if (serverKerberosPrincipal != null){
+ hiveConf.setBoolVar(HiveConf.ConfVars.METASTORE_USE_THRIFT_SASL, true);
+ hiveConf.setVar(HiveConf.ConfVars.METASTORE_KERBEROS_PRINCIPAL, serverKerberosPrincipal);
+ }
+
try {
client = new HiveMetaStoreClient(hiveConf,null);
} catch (Exception e){