You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pig.apache.org by da...@apache.org on 2012/03/24 00:58:27 UTC

svn commit: r1304670 - in /pig/trunk: CHANGES.txt test/org/apache/pig/test/TestDataBag.java

Author: daijy
Date: Fri Mar 23 23:58:27 2012
New Revision: 1304670

URL: http://svn.apache.org/viewvc?rev=1304670&view=rev
Log:
PIG-2550: Custom tuple results in 'Unexpected datatype 110 while reading tuplefrom binary file' while spilling

Modified:
    pig/trunk/CHANGES.txt
    pig/trunk/test/org/apache/pig/test/TestDataBag.java

Modified: pig/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/pig/trunk/CHANGES.txt?rev=1304670&r1=1304669&r2=1304670&view=diff
==============================================================================
--- pig/trunk/CHANGES.txt (original)
+++ pig/trunk/CHANGES.txt Fri Mar 23 23:58:27 2012
@@ -457,6 +457,8 @@ Release 0.9.3 - Unreleased
 
 BUG FIXES
 
+PIG-2550: Custom tuple results in "Unexpected datatype 110 while reading tuplefrom binary file" while spilling (daijy)
+
 PIG-2442: Multiple Stores in pig streaming causes infinite waiting (daijy)
 
 PIG-2609: e2e harness: make hdfs base path configurable (outside default.conf) (thw via daijy)

Modified: pig/trunk/test/org/apache/pig/test/TestDataBag.java
URL: http://svn.apache.org/viewvc/pig/trunk/test/org/apache/pig/test/TestDataBag.java?rev=1304670&r1=1304669&r2=1304670&view=diff
==============================================================================
--- pig/trunk/test/org/apache/pig/test/TestDataBag.java (original)
+++ pig/trunk/test/org/apache/pig/test/TestDataBag.java Fri Mar 23 23:58:27 2012
@@ -1156,6 +1156,31 @@ public class TestDataBag extends junit.f
         assertTrue(dfBag.equals(stBag));
     }
     
+    // See PIG-2550
+    static class MyCustomTuple extends DefaultTuple {
+        private static final long serialVersionUID = 8156382697467819543L;
+        public MyCustomTuple() {
+            super();
+        }
+        public MyCustomTuple(Object t) {
+            super();
+            append(t);
+        }
+    }
+
+    @Test
+    public void testSpillCustomTuple() throws Exception {
+        DataBag bag = new DefaultDataBag();
+        Tuple t = new MyCustomTuple();
+        t.append(1);
+        t.append("hello");
+        bag.add(t);
+        bag.spill();
+        Iterator<Tuple> iter = bag.iterator();
+        Tuple t2 = iter.next();
+        assertTrue(t2.equals(t));
+    }
+    
     void processDataBag(DataBag bg, boolean doSpill) {
         Tuple t = TupleFactory.getInstance().newTuple(new Integer(0));
         bg.add(t);