sqoop-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From q..@apache.org
Subject sqoop git commit: SQOOP-2400: hive.metastore.sasl.enabled should be set to true for Oozie integration
Date Thu, 25 Jun 2015 17:24:17 GMT
Repository: sqoop
Updated Branches:
  refs/heads/trunk 71956cad3 -> 1ffda71a2


SQOOP-2400: hive.metastore.sasl.enabled should be set to true for Oozie integration

(Abraham Elmahrek via Qian Xu)


Project: http://git-wip-us.apache.org/repos/asf/sqoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/sqoop/commit/1ffda71a
Tree: http://git-wip-us.apache.org/repos/asf/sqoop/tree/1ffda71a
Diff: http://git-wip-us.apache.org/repos/asf/sqoop/diff/1ffda71a

Branch: refs/heads/trunk
Commit: 1ffda71a2d00476dd57e72b785de8d9bb5085771
Parents: 71956ca
Author: Qian Xu <qian.a.xu@intel.com>
Authored: Fri Jun 26 01:22:06 2015 +0800
Committer: Qian Xu <qian.a.xu@intel.com>
Committed: Fri Jun 26 01:22:06 2015 +0800

----------------------------------------------------------------------
 src/java/org/apache/sqoop/hive/HiveImport.java | 33 +++++++++++++--------
 1 file changed, 20 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/sqoop/blob/1ffda71a/src/java/org/apache/sqoop/hive/HiveImport.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/sqoop/hive/HiveImport.java b/src/java/org/apache/sqoop/hive/HiveImport.java
index 097d622..2ec7f2b 100644
--- a/src/java/org/apache/sqoop/hive/HiveImport.java
+++ b/src/java/org/apache/sqoop/hive/HiveImport.java
@@ -25,7 +25,8 @@ import java.io.OutputStreamWriter;
 import java.io.IOException;
 import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
-import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.LinkedList;
 import java.util.List;
 
 import org.apache.commons.logging.Log;
@@ -323,14 +324,11 @@ public class HiveImport {
       subprocessSM = new SubprocessSecurityManager();
       subprocessSM.install();
 
-      // Create the argv for the Hive Cli Driver.
-      String [] argArray = new String[2];
-      argArray[0] = "-f";
-      argArray[1] = filename;
+      String[] argv = getHiveArgs("-f", filename);
 
       // And invoke the static method on this array.
-      Method mainMethod = cliDriverClass.getMethod("main", argArray.getClass());
-      mainMethod.invoke(null, (Object) argArray);
+      Method mainMethod = cliDriverClass.getMethod("main", String[].class);
+      mainMethod.invoke(null, (Object) argv);
 
     } catch (ClassNotFoundException cnfe) {
       // Hive is not on the classpath. Run externally.
@@ -377,17 +375,26 @@ public class HiveImport {
       throws IOException {
     // run Hive on the script and note the return code.
     String hiveExec = getHiveBinPath();
-    ArrayList<String> args = new ArrayList<String>();
-    args.add(hiveExec);
-    args.add("-f");
-    args.add(filename);
+
+    String[] argv = getHiveArgs(hiveExec, "-f", filename);
 
     LoggingAsyncSink logSink = new LoggingAsyncSink(LOG);
-    int ret = Executor.exec(args.toArray(new String[0]),
-        env.toArray(new String[0]), logSink, logSink);
+    int ret = Executor.exec(argv, env.toArray(new String[0]), logSink, logSink);
     if (0 != ret) {
       throw new IOException("Hive exited with status " + ret);
     }
   }
+
+  private String[] getHiveArgs(String... args) {
+    List<String> newArgs = new LinkedList<String>();
+    newArgs.addAll(Arrays.asList(args));
+
+    if (System.getProperty("mapreduce.job.credentials.binary") != null) {
+      newArgs.add("--hiveconf");
+      newArgs.add("hive.metastore.sasl.enabled=true");
+    }
+
+    return newArgs.toArray(new String[newArgs.size()]);
+  }
 }
 


Mime
View raw message