private String[] getParams() { ArrayList<String> list = new ArrayList<String>(); Map<String, String> map = getPigParams(); if (map != null) { for (Map.Entry<String, String> entry : map.entrySet()) { list.add("-param"); list.add( StringUtils.shellQuote( entry.getKey() + "=" + entry.getValue(), StringUtils.SINGLE_QUOTE)); } } // Run in local mode if filesystem is set to local. if (prop.getString("reportal.output.filesystem", "local").equals("local")) { list.add("-x"); list.add("local"); } // Register any additional Pig jars String additionalPigJars = prop.getString(PIG_ADDITIONAL_JARS, null); if (additionalPigJars != null && additionalPigJars.length() > 0) { list.add("-Dpig.additional.jars=" + additionalPigJars); } // Add UDF import list String udfImportList = prop.getString(UDF_IMPORT_LIST, null); if (udfImportList != null && udfImportList.length() > 0) { list.add("-Dudf.import.list=" + udfImportList); } list.add(prop.getString(PIG_SCRIPT)); return list.toArray(new String[0]); }
@Override protected String getMainArguments() { ArrayList<String> list = new ArrayList<String>(); Map<String, String> map = getPigParams(); if (map != null) { for (Map.Entry<String, String> entry : map.entrySet()) { list.add( "-param " + StringUtils.shellQuote( entry.getKey() + "=" + entry.getValue(), StringUtils.SINGLE_QUOTE)); } } List<String> paramFiles = getPigParamFiles(); if (paramFiles != null) { for (String paramFile : paramFiles) { list.add("-param_file " + paramFile); } } if (getDebug()) { list.add("-debug"); } try { pigLogFile = File.createTempFile("piglogfile", ".log", new File(getWorkingDirectory())); jobProps.put("env." + "PIG_LOG_FILE", pigLogFile.getAbsolutePath()); } catch (IOException e) { e.printStackTrace(); } if (pigLogFile != null) { list.add("-logfile " + pigLogFile.getAbsolutePath()); } list.add(getScript()); return StringUtils.join((Collection<String>) list, " "); }