sqoop-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From venkatran...@apache.org
Subject sqoop git commit: SQOOP-2896: Sqoop exec job fails with SQLException Access denied for user
Date Wed, 30 Mar 2016 01:02:40 GMT
Repository: sqoop
Updated Branches:
  refs/heads/trunk 1dd50cfb2 -> 729e681f1


SQOOP-2896: Sqoop exec job fails with SQLException Access denied for user

    (Sowmya Ramesh via Venkat Ranganathan)


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

Branch: refs/heads/trunk
Commit: 729e681f106d58d4048e002a00b1112cec3a0a5b
Parents: 1dd50cf
Author: Venkat Ranganathan <venkat@hortonworks.com>
Authored: Tue Mar 29 18:02:19 2016 -0700
Committer: Venkat Ranganathan <venkat@hortonworks.com>
Committed: Tue Mar 29 18:02:19 2016 -0700

----------------------------------------------------------------------
 src/java/org/apache/sqoop/tool/JobTool.java | 32 +++++++++++++++++++++++-
 1 file changed, 31 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/sqoop/blob/729e681f/src/java/org/apache/sqoop/tool/JobTool.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/sqoop/tool/JobTool.java b/src/java/org/apache/sqoop/tool/JobTool.java
index 2eafac3..8e1669c 100644
--- a/src/java/org/apache/sqoop/tool/JobTool.java
+++ b/src/java/org/apache/sqoop/tool/JobTool.java
@@ -28,6 +28,7 @@ import java.util.TreeMap;
 
 import org.apache.commons.cli.CommandLine;
 import org.apache.commons.cli.ParseException;
+import org.apache.commons.lang3.ArrayUtils;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
@@ -50,6 +51,7 @@ public class JobTool extends com.cloudera.sqoop.tool.BaseSqoopTool {
 
   public static final Log LOG = LogFactory.getLog(
       JobTool.class.getName());
+  private static final String DASH_STR  = "--";
 
   private enum JobOp {
     JobCreate,
@@ -210,7 +212,35 @@ public class JobTool extends com.cloudera.sqoop.tool.BaseSqoopTool {
     SqoopOptions clonedOpts = (SqoopOptions) childOpts.clone();
     clonedOpts.setParent(childOpts);
 
-    return childTool.run(clonedOpts);
+    String [] childArgv = childOpts.getExtraArgs();
+    if (childArgv == null || childArgv.length == 0) {
+        childArgv = new String[0];
+    }
+
+    int dashPos = getDashPosition(extraArguments);
+    if (dashPos < extraArguments.length) {
+        String[] extraArgs = Arrays.copyOfRange(extraArguments, dashPos + 1,
+                extraArguments.length);
+        if (childArgv == null || childArgv.length == 0) {
+            childArgv = extraArgs;
+        } else {
+            // Find the second dash pos
+            int dashPos2 = getDashPosition(extraArgs);
+            if (dashPos2 >= extraArgs.length) {
+                // if second dash is not present add it
+                extraArgs = ArrayUtils.addAll(extraArgs, DASH_STR);
+            }
+            childArgv = ArrayUtils.addAll(extraArgs, childArgv);
+        }
+    }
+
+    int confRet = configureChildTool(clonedOpts, childTool, childArgv);
+    if (0 != confRet) {
+        // Error.
+        return confRet;
+    }
+
+      return childTool.run(clonedOpts);
   }
 
   private int showJob(SqoopOptions opts) throws IOException {


Mime
View raw message