HCatSchema structSubSchema = hcatFS.getStructSubSchema(); List<Object> all = ((Tuple) pigObj).getAll(); ArrayList<Object> converted = new ArrayList<Object>(all.size()); for (int i = 0; i < all.size(); i++) {
List<Object> tuples = ((Tuple) object).getAll();
List<Object> data = tuple.getAll(); return data.toArray();
@Override public List<Object> getStructFieldsDataAsList(Object object) { return ((Tuple) object).getAll(); }
@Override public List<Object> getAll() { return t.getAll(); }
@Override public List<Object> getAll() { return t.getAll(); }
@Override public String exec(Tuple input) throws IOException { if (input == null) { return null; } StringBuilder sb = new StringBuilder(INITIAL_CAPACITY); for (Object item : input.getAll()) { sb.append(item); } return sb.toString(); } }
/** * Purely for debugging */ public static void spillTupleContents(Tuple t, String label) { System.out.print("Tuple " + label + " "); Iterator<Object> i = t.getAll().iterator(); for (int j = 0; i.hasNext(); j++) { System.out.print(j + ":" + i.next().getClass().getName() + " "); } System.out.println(t.toString()); }
public static void convertNullToUnknown(Tuple tuple) throws ExecException { int idx = 0; for(Object obj : tuple.getAll()) { if( (obj == null) ) { tuple.set(idx, unknown); } idx++; } }
@Override public List<Object> getAll() { convertAll(); return realTuple.getAll(); }
@Override @SuppressWarnings("unchecked") protected void reduce(IntWritable key, Iterable<DefaultTuple> values, Context context) throws IOException, InterruptedException { int keyInt=key.get(); Set<String> tempSet=new HashSet<String>(); for (Tuple aw:values) { tempSet.addAll((Collection<? extends String>)(Collection)aw.getAll()); } ( (Set<String>) urlsForVals[keyInt]).addAll(tempSet); DefaultTuple tup=(DefaultTuple) factory.newTuple(new ArrayList<String>(tempSet)); context.write(key, tup ); }
@Override public void putNext(Tuple t) throws IOException { mockRecordWriter.dataBeingWritten.add(TF.newTuple(t.getAll())); }
@Override public Tuple call(Tuple input) throws Exception { Tuple output = TupleFactory.getInstance() .newTuple(input.getAll().size() - 2); for (int i = 1; i < input.getAll().size() - 2; i ++) { output.set(i, input.get(i+2)); } long offset = calculateOffset((Integer) input.get(0)); output.set(0, offset + (Long)input.get(2)); return output; }
public static PyTuple pigTupleToPyTuple(Tuple tuple) { PyObject[] pyTuple = new PyObject[tuple.size()]; int i = 0; for (Object object : tuple.getAll()) { pyTuple[i++] = pigToPython(object); } return new PyTuple(pyTuple); }
/** * A type specific conversion routine. * * @param ruby the Ruby runtime to create objects in * @param object object to convert * @return analogous Ruby type * @throws ExecException object contained an object that could not convert */ public static RubyArray pigToRuby(Ruby ruby, Tuple object) throws ExecException{ RubyArray rubyArray = ruby.newArray(); for (Object o : object.getAll()) rubyArray.add(pigToRuby(ruby, o)); return rubyArray; }
@SuppressWarnings("unchecked") //this is ok because we only cast to T after checking protected SchemaTuple<T> set(Tuple t, boolean checkType) throws ExecException { if (checkType) { if (isSpecificSchemaTuple(t)) { return setSpecific((T)t); } if (t instanceof SchemaTuple<?>) { return set((SchemaTuple<?>)t, false); } } return set(t.getAll()); }
public Tuple exec(Tuple input) throws IOException { Tuple tuple = TupleFactory.getInstance().newTuple(); if (input.size() < this.columnConfigList.size()) { throw new ShifuException(ShifuErrorCode.ERROR_NO_EQUAL_COLCONFIG); } List<Object> filteredData = DataSampler.filter(tagColumnNum, posTags, negTags, input.getAll(), sampleRate, sampleNegOnly); if (filteredData == null) { return null; } for (Object o : filteredData) { tuple.append(o); } return tuple; }
private Tuple applyLRon(final Tuple inp, final int lrIdx) throws ExecException{ //Separate Key & Value of input using corresponding LR operator POLocalRearrange lr = LRs[lrIdx]; lr.attachInput(inp); Result lrOut = lr.getNextTuple(); if(lrOut.returnStatus!=POStatus.STATUS_OK){ int errCode = 2167; String errMsg = "LocalRearrange used to extract keys from tuple isn't configured correctly"; throw new ExecException(errMsg,errCode,PigException.BUG); } lr.detachInput(); return mTupleFactory.newTuple(((Tuple)lrOut.result).getAll()); }