@Override protected void doHadoopWork() throws BuildException { Tuple tuple = ContextManager.getCurrentTuple(); if (tuple == null) { throw new BuildException( this.getTaskName() + " should be put inside task container which provides tuple to execution context"); } try { if (tuple.getType(fieldNumber) != DataType.TUPLE || !(tuple.get(fieldNumber) instanceof Tuple)) { throw new BuildException("Tuple field " + fieldNumber + " doesn't represent a Tuple"); } ContextManager.setCurrentTupleContext((Tuple) tuple.get(fieldNumber)); try { for (Task task : tasks) { task.perform(); } } finally { ContextManager.resetCurrentTupleContext(); } } catch (ExecException e) { throw new BuildException("Failed to check type of tuple field " + fieldNumber, e); } }
/** * Method put places the values of the given tuple into the positions specified by the fields * argument. The declarator Fields value declares the fields in this Tuple instance. * * @param declarator of type Fields * @param fields of type Fields * @param tuple of type Tuple */ public void put(Fields declarator, Fields fields, Tuple tuple) { verifyModifiable(); int[] pos = declarator.getPos(fields, size()); for (int i = 0; i < pos.length; i++) elements.set(pos[i], tuple.get(i)); }