Return-Path: X-Original-To: apmail-pig-commits-archive@www.apache.org Delivered-To: apmail-pig-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id E995C736D for ; Tue, 22 Nov 2011 01:26:42 +0000 (UTC) Received: (qmail 71343 invoked by uid 500); 22 Nov 2011 01:26:42 -0000 Delivered-To: apmail-pig-commits-archive@pig.apache.org Received: (qmail 71319 invoked by uid 500); 22 Nov 2011 01:26:42 -0000 Mailing-List: contact commits-help@pig.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@pig.apache.org Delivered-To: mailing list commits@pig.apache.org Received: (qmail 71312 invoked by uid 99); 22 Nov 2011 01:26:42 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 22 Nov 2011 01:26:42 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 22 Nov 2011 01:26:39 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 889FE2388C7B for ; Tue, 22 Nov 2011 01:26:18 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: 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 Date: Tue, 22 Nov 2011 01:26:18 -0000 To: commits@pig.apache.org From: dvryaboy@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20111122012618.889FE2388C7B@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org 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)); +} }