[
https://issues.apache.org/jira/browse/PIG-2550?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13214831#comment-13214831
]
Vivek Padmanabhan commented on PIG-2550:
----------------------------------------
I got the script running after overriding read and write methods in the custom
tuple
{code}
public class MyCustomTuple extends DefaultTuple {
private static final long serialVersionUID = 8156382697467819543L;
private static final InterSedes sedes =
InterSedesFactory.getInterSedesInstance();
public MyCustomTuple() {
super();
}
public MyCustomTuple(Object t) {
super();
append(t);
}
public void write(DataOutput out) throws IOException {
sedes.writeDatum(out, this);
}
public void readFields(DataInput in) throws IOException {
// Clear our fields, in case we're being reused.
mFields.clear();
sedes.addColsToTuple(in, this);
}
}
{code}
I am not sure whether overriding write() will have any other impacts. Could
this be considered as a workaround ?
> Custom tuple results in "Unexpected datatype 110 while reading tuplefrom
> binary file" while spilling
> ----------------------------------------------------------------------------------------------------
>
> Key: PIG-2550
> URL: https://issues.apache.org/jira/browse/PIG-2550
> Project: Pig
> Issue Type: Bug
> Affects Versions: 0.8.1, 0.9.1, 0.10
> Reporter: Vivek Padmanabhan
> Attachments: REPRODUCING_SPILL_ERROR.txt
>
>
> In the below script ;
> {code}
> a = load 'gen_data/' AS (f1,f2);
> b = load 'gen_data_02/' AS (f1,f2);
> c = cogroup a by f1,b by f1;
> d = foreach c generate
> group,flatten(a),COUNT(b),flatten(UDFReturningMyCustomTuple(b,a));
> store d into 'test006';
> {code}
> The udf (UDFReturningMyCustomTuple) returns a bag which contains custom
> tuples.
> The script execution fails at the reducer side with the below exception while
> reading back the spilled data,
> 2012-02-23 10:37:16,840 FATAL org.apache.pig.data.DefaultDataBag: Unable to
> read our spill file.
> org.apache.pig.backend.executionengine.ExecException: ERROR 2112: Unexpected
> datatype 110 while reading tuple from binary file.
> at
> org.apache.pig.data.BinInterSedes.getTupleSize(BinInterSedes.java:133)
> at
> org.apache.pig.data.BinInterSedes.addColsToTuple(BinInterSedes.java:556)
> at org.apache.pig.data.BinSedesTuple.readFields(BinSedesTuple.java:66)
> at
> org.apache.pig.data.DefaultDataBag$DefaultDataBagIterator.next(DefaultDataBag.java:215)
> at
> org.apache.pig.data.DefaultDataBag$DefaultDataBagIterator.hasNext(DefaultDataBag.java:158)
> at
> org.apache.pig.backend.hadoop.executionengine.physicalLayer.relationalOperators.POForEach.processPlan(POForEach.java:301)
> at
> org.apache.pig.backend.hadoop.executionengine.physicalLayer.relationalOperators.POForEach.getNext(POForEach.java:208)
> at
> org.apache.pig.backend.hadoop.executionengine.mapReduceLayer.PigGenericMapReduce$Reduce.runPipeline(PigGenericMapReduce.java:459)
> at
> org.apache.pig.backend.hadoop.executionengine.mapReduceLayer.PigGenericMapReduce$Reduce.processOnePackageOutput(PigGenericMapReduce.java:427)
> at
> org.apache.pig.backend.hadoop.executionengine.mapReduceLayer.PigGenericMapReduce$Reduce.reduce(PigGenericMapReduce.java:407)
> at
> org.apache.pig.backend.hadoop.executionengine.mapReduceLayer.PigGenericMapReduce$Reduce.reduce(PigGenericMapReduce.java:261)
> at org.apache.hadoop.mapreduce.Reducer.run(Reducer.java:176)
> at
> org.apache.hadoop.mapred.ReduceTask.runNewReducer(ReduceTask.java:649)
> at org.apache.hadoop.mapred.ReduceTask.run(ReduceTask.java:417)
> at org.apache.hadoop.mapred.Child$4.run(Child.java:255)
> at java.security.AccessController.doPrivileged(Native Method)
> at javax.security.auth.Subject.doAs(Subject.java:396)
> at
> org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1082)
> at org.apache.hadoop.mapred.Child.main(Child.java:249)
> It looks like while spilling we do MyCustomTuple.write(DataOutput out) which
> writes the type as DataType.TUPLE (110),
> but while reading back we always use BinSedesTuple.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira