diff --git a/ql/src/java/org/apache/hadoop/hive/ql/exec/SecureCmdDoAs.java b/ql/src/java/org/apache/hadoop/hive/ql/exec/SecureCmdDoAs.java index 8124639..832f84f 100644 --- a/ql/src/java/org/apache/hadoop/hive/ql/exec/SecureCmdDoAs.java +++ b/ql/src/java/org/apache/hadoop/hive/ql/exec/SecureCmdDoAs.java @@ -38,14 +38,6 @@ public SecureCmdDoAs(HiveConf conf) throws HiveException, IOException{ tokenPath = ShimLoader.getHadoopShims().createDelegationTokenFile(conf); } - public String addArg(String cmdline) throws HiveException { - StringBuilder sb = new StringBuilder(); - sb.append(cmdline); - sb.append(" -hadooptoken "); - sb.append(tokenPath.toUri().getPath()); - return sb.toString(); - } - public void addEnv(Map env){ env.put(ShimLoader.getHadoopShims().getTokenFileLocEnvName(), tokenPath.toUri().getPath()); diff --git a/ql/src/java/org/apache/hadoop/hive/ql/exec/mr/ExecDriver.java b/ql/src/java/org/apache/hadoop/hive/ql/exec/mr/ExecDriver.java index 4cc7129..bd9d0bb 100644 --- a/ql/src/java/org/apache/hadoop/hive/ql/exec/mr/ExecDriver.java +++ b/ql/src/java/org/apache/hadoop/hive/ql/exec/mr/ExecDriver.java @@ -615,7 +615,6 @@ public static void main(String[] args) throws IOException, HiveException { boolean noLog = false; String files = null; boolean localtask = false; - String hadoopAuthToken = null; try { for (int i = 0; i < args.length; i++) { if (args[i].equals("-plan")) { @@ -628,9 +627,6 @@ public static void main(String[] args) throws IOException, HiveException { files = args[++i]; } else if (args[i].equals("-localtask")) { localtask = true; - } else if (args[i].equals("-hadooptoken")) { - //set with HS2 in secure mode with doAs - hadoopAuthToken = args[++i]; } } } catch (IndexOutOfBoundsException e) { @@ -652,6 +648,9 @@ public static void main(String[] args) throws IOException, HiveException { if (files != null) { conf.set("tmpfiles", files); } + + String hadoopAuthToken = + System.getenv(ShimLoader.getHadoopShims().getTokenFileLocEnvName()); if(hadoopAuthToken != null){ conf.set("mapreduce.job.credentials.binary", hadoopAuthToken); } diff --git a/ql/src/java/org/apache/hadoop/hive/ql/exec/mr/MapredLocalTask.java b/ql/src/java/org/apache/hadoop/hive/ql/exec/mr/MapredLocalTask.java index 341154d..96f6a8c 100644 --- a/ql/src/java/org/apache/hadoop/hive/ql/exec/mr/MapredLocalTask.java +++ b/ql/src/java/org/apache/hadoop/hive/ql/exec/mr/MapredLocalTask.java @@ -236,7 +236,6 @@ public int execute(DriverContext driverContext) { // then additional params need to be set so that the command is run as // intended user SecureCmdDoAs secureDoAs = new SecureCmdDoAs(conf); - cmdLine = secureDoAs.addArg(cmdLine); secureDoAs.addEnv(variables); }