[ 
https://issues.apache.org/jira/browse/PIG-2550?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13218083#comment-13218083
 ] 

Vivek Padmanabhan commented on PIG-2550:
----------------------------------------

For the error to happen DefaultDataBag should be spilling data on reduce side. 
This test was run on MR mode.

gen_data is same as asgen_data_02 but with a smaller value.

{code}
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
public class Gen {

    public static void main(String[] args) throws IOException {
        BufferedWriter bw = new BufferedWriter( new FileWriter( new File 
("tmp_data")));

        StringBuffer sb = new StringBuffer ();
        for(int i=0;i < 200; i ++)
            sb.append(i);
        bw.write(sb.toString());
        bw.write("\t");
        
        for(int i=0;i < 5*1000 ; i ++)
            bw.write(""+i%10);
        bw.close();        
    }
}
{code}

BTW I tried to set pig.data.tuple.factory.name to 
org.apache.pig.data.DefaultTupleFactory but the property is not picked up in 
the map/reduce tasks.
                
> 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

        

Reply via email to