public Field(JsonString name, Schema schema, boolean isOptional) { JaqlUtil.enforceNonNull(name); JaqlUtil.enforceNonNull(schema); this.name = FieldNameCache.get(name); this.isOptional = isOptional; this.schema = schema; }
private void initProcess(Context context) throws Exception { ProcessBuilder pb = new ProcessBuilder(); if (cmd instanceof JsonString) { String tmp = ((JsonString) cmd).toString(); String[] cmdArray = tmp.split(" "); ArrayList<String> array = new ArrayList<String>(); for (String s : cmdArray) { if (s.length() > 0) array.add(s.trim()); } pb.command(array); } Configuration cfg = new Configuration(); File directory = new File(cfg.get("mapred.local.dir", ".")); pb.directory(directory); // unset environment variables that jvm dump to stderr pb.environment().remove("_JAVA_OPTIONS"); pb.environment().remove("JAVA_TOOL_OPTIONS"); process = pb.start(); ErrorThread errorThread = new ErrorThread(); errorThread.start(); stdin = process.getInputStream(); stdout = process.getOutputStream(); OutputAdapter outAdapter = (OutputAdapter) JaqlUtil.getAdapterStore().output.getAdapter(writeOpts); if (!(outAdapter instanceof StreamOutputAdapter)) throw new IllegalArgumentException( "The adapter of writeOpts must be an instance of com.ibm.jaql.io.stream.StreamOutputAdapter"); ((StreamOutputAdapter) outAdapter).setDefaultOutput(stdout); outAdapter.open(); writer = outAdapter.getWriter(); InputAdapter inAdapter = (InputAdapter) JaqlUtil.getAdapterStore().input.getAdapter(readOpts); if (!(inAdapter instanceof StreamInputAdapter)) throw new IllegalArgumentException( "The adapter of readOpts must be an instance of com.ibm.jaql.io.stream.ExternalCallStreamInputAdapter"); ((StreamInputAdapter) inAdapter).setInputStream(stdin); inAdapter.open(); reader = inAdapter.iter(); }