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 2011/04/29 02:40:26 UTC

svn commit: r1097663 - in /pig/branches/branch-0.9: CHANGES.txt src/org/apache/pig/data/BinInterSedes.java test/org/apache/pig/test/MiniCluster.java test/org/apache/pig/test/TestEvalPipeline2.java

Author: daijy
Date: Fri Apr 29 00:40:25 2011
New Revision: 1097663

URL: http://svn.apache.org/viewvc?rev=1097663&view=rev
Log:
PIG-1826: Unexpected data type -1 found in stream error

Modified:
    pig/branches/branch-0.9/CHANGES.txt
    pig/branches/branch-0.9/src/org/apache/pig/data/BinInterSedes.java
    pig/branches/branch-0.9/test/org/apache/pig/test/MiniCluster.java
    pig/branches/branch-0.9/test/org/apache/pig/test/TestEvalPipeline2.java

Modified: pig/branches/branch-0.9/CHANGES.txt
URL: http://svn.apache.org/viewvc/pig/branches/branch-0.9/CHANGES.txt?rev=1097663&r1=1097662&r2=1097663&view=diff
==============================================================================
--- pig/branches/branch-0.9/CHANGES.txt (original)
+++ pig/branches/branch-0.9/CHANGES.txt Fri Apr 29 00:40:25 2011
@@ -174,6 +174,8 @@ PIG-1696: Performance: Use System.arrayc
 
 BUG FIXES
 
+PIG-1826: Unexpected data type -1 found in stream error (daijy)
+
 PIG-2004: Incorrect input types passed on to eval function (thejas)
 
 PIG-1814: mapred.output.compress in SET statement does not work (daijy)

Modified: pig/branches/branch-0.9/src/org/apache/pig/data/BinInterSedes.java
URL: http://svn.apache.org/viewvc/pig/branches/branch-0.9/src/org/apache/pig/data/BinInterSedes.java?rev=1097663&r1=1097662&r2=1097663&view=diff
==============================================================================
--- pig/branches/branch-0.9/src/org/apache/pig/data/BinInterSedes.java (original)
+++ pig/branches/branch-0.9/src/org/apache/pig/data/BinInterSedes.java Fri Apr 29 00:40:25 2011
@@ -475,7 +475,8 @@ public class BinInterSedes implements In
             break;
 
         default:
-            throw new RuntimeException("Unexpected data type " + type + " found in stream.");
+            throw new RuntimeException("Unexpected data type " + val.getClass().getName() + " found in stream. " +
+                    "Note only standard Pig type is supported when you output from UDF/LoadFunc");
         }
     }
 

Modified: pig/branches/branch-0.9/test/org/apache/pig/test/MiniCluster.java
URL: http://svn.apache.org/viewvc/pig/branches/branch-0.9/test/org/apache/pig/test/MiniCluster.java?rev=1097663&r1=1097662&r2=1097663&view=diff
==============================================================================
--- pig/branches/branch-0.9/test/org/apache/pig/test/MiniCluster.java (original)
+++ pig/branches/branch-0.9/test/org/apache/pig/test/MiniCluster.java Fri Apr 29 00:40:25 2011
@@ -69,6 +69,8 @@ public class MiniCluster {
             m_conf.setInt("mapred.submit.replication", 2);
             m_conf.set("dfs.datanode.address", "0.0.0.0:0");
             m_conf.set("dfs.datanode.http.address", "0.0.0.0:0");
+            m_conf.set("mapred.map.max.attempts", "1");
+            m_conf.set("mapred.reduce.max.attempts", "1");
             m_conf.writeXml(new FileOutputStream(conf_file));
             
             // Set the system properties needed by Pig

Modified: pig/branches/branch-0.9/test/org/apache/pig/test/TestEvalPipeline2.java
URL: http://svn.apache.org/viewvc/pig/branches/branch-0.9/test/org/apache/pig/test/TestEvalPipeline2.java?rev=1097663&r1=1097662&r2=1097663&view=diff
==============================================================================
--- pig/branches/branch-0.9/test/org/apache/pig/test/TestEvalPipeline2.java (original)
+++ pig/branches/branch-0.9/test/org/apache/pig/test/TestEvalPipeline2.java Fri Apr 29 00:40:25 2011
@@ -23,6 +23,7 @@ import java.io.FileOutputStream;
 import java.io.FileReader;
 import java.io.IOException;
 import java.io.PrintStream;
+import java.util.ArrayList;
 import java.util.Collection;
 import java.util.HashMap;
 import java.util.HashSet;
@@ -1484,4 +1485,31 @@ public class TestEvalPipeline2 {
         Assert.assertTrue(t.toString().equals("({(1)})"));
         Assert.assertFalse(iter.hasNext());
     }    
+    
+    static public class UDFWithNonStandardType extends EvalFunc<Tuple>{
+        public Tuple exec(Tuple input) throws IOException {
+            Tuple t = TupleFactory.getInstance().newTuple();
+            t.append(new ArrayList<Integer>());
+            return t;
+        }
+    }
+
+    // See PIG-1826
+    @Test
+    public void testNonStandardData() throws Exception{
+        String[] input1 = {
+                "0",
+        };
+
+        Util.createInputFile(cluster, "table_testNonStandardData", input1);
+        pigServer.registerQuery("a = load 'table_testNonStandardData' as (a0);");
+        pigServer.registerQuery("b = foreach a generate " + UDFWithNonStandardType.class.getName() + "(a0);");
+        
+        try {
+            pigServer.openIterator("b");
+            Assert.fail();
+        } catch (Exception e) {
+            Assert.assertTrue(e.getMessage().contains(ArrayList.class.getName()));
+        }
+    }
 }