Index: hcatalog/src/test/e2e/templeton/tests/jobsubmission.conf =================================================================== --- hcatalog/src/test/e2e/templeton/tests/jobsubmission.conf (revision 1523516) +++ hcatalog/src/test/e2e/templeton/tests/jobsubmission.conf (working copy) @@ -377,8 +377,35 @@ }, + { + #test add jar + 'num' => 9, + 'method' => 'POST', + 'url' => ':TEMPLETON_URL:/templeton/v1/hive', + 'post_options' => ['user.name=:UNAME:','execute=add jar piggybank.jar', 'files=:INPDIR_HDFS:/piggybank.jar',], + 'json_field_substr_match' => { 'id' => '\d+'}, + #results + 'status_code' => 200, + 'check_job_created' => 1, + 'check_job_complete' => 'SUCCESS', + 'check_job_exit_value' => 0, + 'check_call_back' => 1, + }, + { + #test add jar when the jar is not shipped + 'num' => 10, + 'method' => 'POST', + 'url' => ':TEMPLETON_URL:/templeton/v1/hive', + 'post_options' => ['user.name=:UNAME:','execute=add jar piggybank.jar',], + 'json_field_substr_match' => { 'id' => '\d+'}, + #results + 'status_code' => 200, + 'check_job_created' => 1, + 'check_job_complete' => 'SUCCESS', + 'check_job_exit_value' => 1, + 'check_call_back' => 1, + }, - ] }, Index: hcatalog/webhcat/svr/src/main/java/org/apache/hive/hcatalog/templeton/HiveDelegator.java =================================================================== --- hcatalog/webhcat/svr/src/main/java/org/apache/hive/hcatalog/templeton/HiveDelegator.java (revision 1523516) +++ hcatalog/webhcat/svr/src/main/java/org/apache/hive/hcatalog/templeton/HiveDelegator.java (working copy) @@ -22,6 +22,7 @@ import java.io.IOException; import java.net.URISyntaxException; import java.util.ArrayList; +import java.util.Arrays; import java.util.List; import org.apache.commons.exec.ExecuteException; @@ -41,24 +42,26 @@ public EnqueueBean run(String user, String execute, String srcFile, List defines, + List hiveArgs, String otherFiles, String statusdir, String callback, String completedUrl) throws NotAuthorizedException, BadParam, BusyException, QueueException, ExecuteException, IOException, InterruptedException { runAs = user; - List args = makeArgs(execute, srcFile, defines, statusdir, + List args = makeArgs(execute, srcFile, defines, hiveArgs, otherFiles, statusdir, completedUrl); return enqueueController(user, callback, args); } private List makeArgs(String execute, String srcFile, - List defines, String statusdir, String completedUrl) + List defines, List hiveArgs, String otherFiles, + String statusdir, String completedUrl) throws BadParam, IOException, InterruptedException { ArrayList args = new ArrayList(); try { - args.addAll(makeBasicArgs(execute, srcFile, statusdir, completedUrl)); + args.addAll(makeBasicArgs(execute, srcFile, otherFiles, statusdir, completedUrl)); args.add("--"); args.add(appConf.hivePath()); @@ -77,6 +80,7 @@ args.add("--hiveconf"); args.add(prop); } + args.addAll(hiveArgs); if (TempletonUtils.isset(execute)) { args.add("-e"); args.add(execute); @@ -94,8 +98,8 @@ return args; } - private List makeBasicArgs(String execute, String srcFile, - String statusdir, String completedUrl) + private List makeBasicArgs(String execute, String srcFile, String otherFiles, + String statusdir, String completedUrl) throws URISyntaxException, FileNotFoundException, IOException, InterruptedException { @@ -106,6 +110,11 @@ allFiles.add(TempletonUtils.hadoopFsFilename(srcFile, appConf, runAs)); + if (TempletonUtils.isset(otherFiles)) { + String[] ofs = TempletonUtils.hadoopFsListAsArray(otherFiles, appConf, runAs); + allFiles.addAll(Arrays.asList(ofs)); + } + args.addAll(makeLauncherArgs(appConf, statusdir, completedUrl, allFiles)); args.add("-archives"); Index: hcatalog/webhcat/svr/src/main/java/org/apache/hive/hcatalog/templeton/Server.java =================================================================== --- hcatalog/webhcat/svr/src/main/java/org/apache/hive/hcatalog/templeton/Server.java (revision 1523516) +++ hcatalog/webhcat/svr/src/main/java/org/apache/hive/hcatalog/templeton/Server.java (working copy) @@ -665,6 +665,8 @@ @Produces({MediaType.APPLICATION_JSON}) public EnqueueBean hive(@FormParam("execute") String execute, @FormParam("file") String srcFile, + @FormParam("arg") List hiveArgs, + @FormParam("files") String otherFiles, @FormParam("define") List defines, @FormParam("statusdir") String statusdir, @FormParam("callback") String callback) @@ -675,7 +677,7 @@ throw new BadParam("Either execute or file parameter required"); HiveDelegator d = new HiveDelegator(appConf); - return d.run(getDoAsUser(), execute, srcFile, defines, + return d.run(getDoAsUser(), execute, srcFile, defines, hiveArgs, otherFiles, statusdir, callback, getCompletedUrl()); }