You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pig.apache.org by dv...@apache.org on 2011/11/22 02:26:18 UTC
svn commit: r1204775 - in /pig/branches/branch-0.9: CHANGES.txt
src/org/apache/pig/impl/logicalLayer/schema/Schema.java
test/org/apache/pig/test/TestSchema.java
Author: dvryaboy
Date: Tue Nov 22 01:26:11 2011
New Revision: 1204775
URL: http://svn.apache.org/viewvc?rev=1204775&view=rev
Log:
Bug in Schema.getPigSchema(ResourceSchema rSchema) improperly adds two level access
Modified:
pig/branches/branch-0.9/CHANGES.txt
pig/branches/branch-0.9/src/org/apache/pig/impl/logicalLayer/schema/Schema.java
pig/branches/branch-0.9/test/org/apache/pig/test/TestSchema.java
Modified: pig/branches/branch-0.9/CHANGES.txt
URL: http://svn.apache.org/viewvc/pig/branches/branch-0.9/CHANGES.txt?rev=1204775&r1=1204774&r2=1204775&view=diff
==============================================================================
--- pig/branches/branch-0.9/CHANGES.txt (original)
+++ pig/branches/branch-0.9/CHANGES.txt Tue Nov 22 01:26:11 2011
@@ -22,6 +22,8 @@ Release 0.9.2 - Unreleased
BUG FIXES
+PIG-2379: Bug in Schema.getPigSchema(ResourceSchema rSchema) improperly adds two level access (jcoveney via dvryaboy)
+
PIG-2320: Error: "projection with nothing to reference" (daijy)
PIG-2346: TypeCastInsert should not insert Foreach if there is no as statement (daijy)
Modified: pig/branches/branch-0.9/src/org/apache/pig/impl/logicalLayer/schema/Schema.java
URL: http://svn.apache.org/viewvc/pig/branches/branch-0.9/src/org/apache/pig/impl/logicalLayer/schema/Schema.java?rev=1204775&r1=1204774&r2=1204775&view=diff
==============================================================================
--- pig/branches/branch-0.9/src/org/apache/pig/impl/logicalLayer/schema/Schema.java (original)
+++ pig/branches/branch-0.9/src/org/apache/pig/impl/logicalLayer/schema/Schema.java Tue Nov 22 01:26:11 2011
@@ -19,24 +19,23 @@ package org.apache.pig.impl.logicalLayer
import java.io.Serializable;
import java.util.ArrayList;
+import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
-import java.util.Collection;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
import org.apache.pig.PigException;
import org.apache.pig.ResourceSchema;
import org.apache.pig.ResourceSchema.ResourceFieldSchema;
import org.apache.pig.data.DataType;
-//import org.apache.pig.impl.logicalLayer.parser.ParseException;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.pig.impl.util.MultiMap;
-import org.apache.pig.impl.logicalLayer.FrontendException;
import org.apache.pig.impl.logicalLayer.CanonicalNamer;
+import org.apache.pig.impl.logicalLayer.FrontendException;
+import org.apache.pig.impl.util.MultiMap;
/**
* The Schema class encapsulates the notion of a schema for a relational operator.
@@ -1872,7 +1871,6 @@ public class Schema implements Serializa
rfs.getSchema() == null ?
null : getPigSchema(rfs.getSchema()), rfs.getType());
- // check if we have a need to set twoLevelAcccessRequired flag
if(rfs.getType() == DataType.BAG) {
if (fs.schema != null) { // allow partial schema
if (fs.schema.size() == 1) {
@@ -1880,9 +1878,6 @@ public class Schema implements Serializa
if (innerFs.type != DataType.TUPLE) {
ResourceFieldSchema.throwInvalidSchemaException();
}
- if (innerFs.schema != null) { // allow partial schema
- fs.schema.setTwoLevelAccessRequired(true);
- }
} else {
ResourceFieldSchema.throwInvalidSchemaException();
}
Modified: pig/branches/branch-0.9/test/org/apache/pig/test/TestSchema.java
URL: http://svn.apache.org/viewvc/pig/branches/branch-0.9/test/org/apache/pig/test/TestSchema.java?rev=1204775&r1=1204774&r2=1204775&view=diff
==============================================================================
--- pig/branches/branch-0.9/test/org/apache/pig/test/TestSchema.java (original)
+++ pig/branches/branch-0.9/test/org/apache/pig/test/TestSchema.java Tue Nov 22 01:26:11 2011
@@ -45,6 +45,7 @@ import junit.framework.Assert;
import org.apache.pig.ExecType;
import org.apache.pig.PigServer;
+import org.apache.pig.ResourceSchema;
import org.apache.pig.data.DataType;
import org.apache.pig.data.Tuple;
import org.apache.pig.impl.logicalLayer.FrontendException;
@@ -54,6 +55,7 @@ import org.apache.pig.impl.logicalLayer.
import org.apache.pig.impl.util.Utils;
import org.apache.pig.newplan.logical.relational.LogicalSchema;
import org.apache.pig.newplan.logical.relational.LogicalSchema.MergeMode;
+import org.apache.pig.parser.ParserException;
import org.junit.Test;
public class TestSchema {
@@ -856,4 +858,11 @@ public class TestSchema {
Assert.assertTrue(e.getErrorCode()==1031);
}
}
+
+ @Test
+ public void testResourceSchemaToSchema() throws ParserException,FrontendException{
+ Schema s1 = Utils.getSchemaFromString("b:bag{t:tuple(name:chararray,age:int)}");
+ Schema s2 = Schema.getPigSchema(new ResourceSchema(s1));
+ Assert.assertTrue(s1.equals(s2));
+}
}