Java Code Examples for org.apache.pig.LoadFunc#join()
The following examples show how to use
org.apache.pig.LoadFunc#join() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MRScriptState.java From spork with Apache License 2.0 | 6 votes |
private void setAlias(MapReduceOper mro) { ArrayList<String> alias = new ArrayList<String>(); String aliasLocationStr = ""; try { ArrayList<String> aliasLocation = new ArrayList<String>(); new AliasVisitor(mro.mapPlan, alias, aliasLocation).visit(); aliasLocationStr += "M: "+LoadFunc.join(aliasLocation, ","); if (mro.combinePlan != null) { aliasLocation = new ArrayList<String>(); new AliasVisitor(mro.combinePlan, alias, aliasLocation).visit(); aliasLocationStr += " C: "+LoadFunc.join(aliasLocation, ","); } aliasLocation = new ArrayList<String>(); new AliasVisitor(mro.reducePlan, alias, aliasLocation).visit(); aliasLocationStr += " R: "+LoadFunc.join(aliasLocation, ","); if (!alias.isEmpty()) { Collections.sort(alias); } } catch (VisitorException e) { LOG.warn("unable to get alias", e); } aliasMap.put(mro, LoadFunc.join(alias, ",")); aliasLocationMap.put(mro, aliasLocationStr); }
Example 2
Source File: TezScriptState.java From spork with Apache License 2.0 | 6 votes |
@Override public void visit() throws VisitorException { super.visit(); if (!aliases.isEmpty()) { ArrayList<String> aliasList = new ArrayList<String>(aliases); ArrayList<String> aliasLocationList = new ArrayList<String>(aliasLocations); Collections.sort(aliasList); Collections.sort(aliasLocationList); alias = LoadFunc.join(aliasList, ","); aliasLocation = LoadFunc.join(aliasLocationList, ","); } StringBuilder sb = new StringBuilder(); for (int i = featureSet.nextSetBit(0); i >= 0; i = featureSet.nextSetBit(i+1)) { if (sb.length() > 0) sb.append(","); sb.append(PIG_FEATURE.values()[i].name()); } features = sb.toString(); }
Example 3
Source File: GruntParser.java From spork with Apache License 2.0 | 6 votes |
@Override protected void processFsCommand(String[] cmdTokens) throws IOException { filter.validate(PigCommandFilter.Command.FS); if(mExplain == null) { // process only if not in "explain" mode executeBatch(); int retCode = -1; try { retCode = shell.run(cmdTokens); } catch (Exception e) { throw new IOException(e); } if (retCode != 0 && !mInteractive) { String s = LoadFunc.join( (AbstractList<String>) Arrays.asList(cmdTokens), " "); throw new IOException("fs command '" + s + "' failed. Please check output logs for details"); } } else { log.warn("'fs' statement is ignored while processing 'explain -script' or '-check'"); } }
Example 4
Source File: TestAvroStorage.java From spork with Apache License 2.0 | 5 votes |
private static String getInputFile(String file) { String locations[] = LoadFunc.getPathStrings(file); if (locations.length == 1) return System.getProperty("user.dir") + "/" + basedir + file; else { ArrayList<String> pathStrings = new ArrayList<String>(); for (int index = 0; index < locations.length; index++) { String f = System.getProperty("user.dir") + "/" + basedir + locations[index].trim(); pathStrings.add(f); } return LoadFunc.join(pathStrings, ","); } }
Example 5
Source File: DryRunGruntParser.java From spork with Apache License 2.0 | 4 votes |
@Override protected void processFsCommand(String[] cmdTokens) throws IOException { String cmds = LoadFunc.join((AbstractList<String>)Arrays.asList(cmdTokens), " "); sb.append("fs ").append(cmds).append("\n"); }
Example 6
Source File: DryRunGruntParser.java From spork with Apache License 2.0 | 4 votes |
@Override protected void processShCommand(String[] cmdTokens) throws IOException { String cmds = LoadFunc.join((AbstractList<String>)Arrays.asList(cmdTokens), " "); sb.append("sh ").append(cmds).append("\n"); }
Example 7
Source File: GruntParser.java From spork with Apache License 2.0 | 4 votes |
@Override protected void processShCommand(String[] cmdTokens) throws IOException { filter.validate(PigCommandFilter.Command.SH); if(mExplain == null) { // process only if not in "explain" mode try { executeBatch(); // For sh command, create a process with the following syntax // <shell exe> <invoke arg> <command-as-string> String shellName = "sh"; String shellInvokeArg = "-c"; // Insert cmd /C in front of the array list to execute to // support built-in shell commands like mkdir on Windows if (System.getProperty("os.name").startsWith("Windows")) { shellName = "cmd"; shellInvokeArg = "/C"; } List<String> stringList = new ArrayList<String>(); stringList.add(shellName); stringList.add(shellInvokeArg); StringBuffer commandString = new StringBuffer(); for (String currToken : cmdTokens) { commandString.append(" "); commandString.append(currToken); } stringList.add(commandString.toString()); String[] newCmdTokens = stringList.toArray(new String[0]); Process executor = Runtime.getRuntime().exec(newCmdTokens); StreamPrinter outPrinter = new StreamPrinter(executor.getInputStream(), null, System.out); StreamPrinter errPrinter = new StreamPrinter(executor.getErrorStream(), null, System.err); outPrinter.start(); errPrinter.start(); int ret = executor.waitFor(); outPrinter.join(); errPrinter.join(); if (ret != 0 && !mInteractive) { String s = LoadFunc.join( (AbstractList<String>) Arrays.asList(cmdTokens), " "); throw new IOException("sh command '" + s + "' failed. Please check output logs for details"); } } catch (Exception e) { throw new IOException(e); } } else { log.warn("'sh' statement is ignored while processing 'explain -script' or '-check'"); } }