Q:

Cascading - cascading.tuple.TupleException: failed to set a value

I am trying to apply ScrubFunction on each tuple and return the tuple with updated values.
But i am getting the Exception like..
Caused by: cascading.tuple.TupleException: failed to set a value, tuple may not be initialized with values, is zero length

Sample Code:
TupleEntry argument = functionCall.getArguments();
        Tuple result = new Tuple();
        result.setInteger(0, argument.getInteger(0));
        result.setString(1, argument.getString(1).toUpperCase());
        result.setString(2, argument.getString(2));
        result.setString(3, argument.getString(3));
        result.setString(4, argument.getString(4));
        result.setString(5, argument.getString(5));
        functionCall.getOutputCollector().add(result);

What if i want to update few fields in a Tuple and return the updated values.
Can i update directly in TupleEntry and return it.

A:

To your first question: don't set values to a tuple, instead, add.
Tuple result = new Tuple();
result.addInteger(argument.getInteger(0));
// ...

To your second question: yes. See the API doc here: TupleEntry.setObject
Hope this helps :)

