pig-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From da...@apache.org
Subject svn commit: r1051238 - in /pig/branches/branch-0.8: CHANGES.txt src/org/apache/pig/newplan/logical/relational/LogicalSchema.java test/org/apache/pig/test/TestEvalPipeline2.java
Date Mon, 20 Dec 2010 18:40:34 GMT
Author: daijy
Date: Mon Dec 20 18:40:34 2010
New Revision: 1051238

URL: http://svn.apache.org/viewvc?rev=1051238&view=rev
Log:
PIG-1771: New logical plan: Merge schema fail if LoadFunc.getSchema return different schema
with "Load...AS"

Modified:
    pig/branches/branch-0.8/CHANGES.txt
    pig/branches/branch-0.8/src/org/apache/pig/newplan/logical/relational/LogicalSchema.java
    pig/branches/branch-0.8/test/org/apache/pig/test/TestEvalPipeline2.java

Modified: pig/branches/branch-0.8/CHANGES.txt
URL: http://svn.apache.org/viewvc/pig/branches/branch-0.8/CHANGES.txt?rev=1051238&r1=1051237&r2=1051238&view=diff
==============================================================================
--- pig/branches/branch-0.8/CHANGES.txt (original)
+++ pig/branches/branch-0.8/CHANGES.txt Mon Dec 20 18:40:34 2010
@@ -211,6 +211,8 @@ PIG-1309: Map-side Cogroup (ashutoshc)
 
 BUG FIXES
 
+PIG-1771: New logical plan: Merge schema fail if LoadFunc.getSchema return different schema
with "Load...AS" (daijy)
+
 PIG-1766: New logical plan: ImplicitSplitInserter should before DuplicateForEachColumnRewrite
(daijy)
 
 PIG-1762: Logical simplification fails on map key referenced values (yanz)

Modified: pig/branches/branch-0.8/src/org/apache/pig/newplan/logical/relational/LogicalSchema.java
URL: http://svn.apache.org/viewvc/pig/branches/branch-0.8/src/org/apache/pig/newplan/logical/relational/LogicalSchema.java?rev=1051238&r1=1051237&r2=1051238&view=diff
==============================================================================
--- pig/branches/branch-0.8/src/org/apache/pig/newplan/logical/relational/LogicalSchema.java
(original)
+++ pig/branches/branch-0.8/src/org/apache/pig/newplan/logical/relational/LogicalSchema.java
Mon Dec 20 18:40:34 2010
@@ -333,9 +333,6 @@ public class LogicalSchema {
             
             if (DataType.isSchemaType(mergedType)) {
                 mergedSubSchema = merge(fs1.schema, fs2.schema);
-                if (mergedSubSchema==null) {
-                    throw new FrontendException("Error merging schema " + fs1 + " and " +
fs2, 2246);
-                }
             }
             LogicalFieldSchema mergedFS = new LogicalFieldSchema(mergedAlias, mergedSubSchema,
mergedType);
             mergedSchema.addField(mergedFS);

Modified: pig/branches/branch-0.8/test/org/apache/pig/test/TestEvalPipeline2.java
URL: http://svn.apache.org/viewvc/pig/branches/branch-0.8/test/org/apache/pig/test/TestEvalPipeline2.java?rev=1051238&r1=1051237&r2=1051238&view=diff
==============================================================================
--- pig/branches/branch-0.8/test/org/apache/pig/test/TestEvalPipeline2.java (original)
+++ pig/branches/branch-0.8/test/org/apache/pig/test/TestEvalPipeline2.java Mon Dec 20 18:40:34
2010
@@ -996,4 +996,23 @@ public class TestEvalPipeline2 extends T
         assertTrue(t.get(0).equals("one"));
         assertTrue(t.get(1).equals("two"));
     }
+    
+    // See PIG-1771
+    @Test
+    public void testLoadWithDifferentSchema() throws Exception{
+        String[] input1 = {
+                "hello\thello\t(hello)\t[key#value]",
+        };
+        
+        Util.createInputFile(cluster, "table_testLoadWithDifferentSchema1", input1);
+        pigServer.registerQuery("a = load 'table_testLoadWithDifferentSchema1' as (a0:chararray,
a1:chararray, a2, a3:map[]);");
+        pigServer.store("a", "table_testLoadWithDifferentSchema1.bin", "org.apache.pig.builtin.BinStorage");
+        
+        pigServer.registerQuery("b = load 'table_testLoadWithDifferentSchema1.bin' USING
BinStorage('Utf8StorageConverter') AS (b0:chararray, b1:chararray, b2:tuple(), b3:map[]);");
+        Iterator<Tuple> iter = pigServer.openIterator("b");
+        
+        Tuple t = iter.next();
+        assertTrue(t.size()==4);
+        assertTrue(t.toString().equals("(hello,hello,(hello),[key#value])"));
+    }
 }



Mime
View raw message