You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pig.apache.org by ol...@apache.org on 2008/07/17 00:33:18 UTC

svn commit: r677451 - in /incubator/pig/branches/types/src/org/apache/pig: ReversibleLoadStoreFunc.java builtin/BinStorage.java builtin/PigStorage.java impl/logicalLayer/parser/QueryParser.jjt

Author: olga
Date: Wed Jul 16 15:33:18 2008
New Revision: 677451

URL: http://svn.apache.org/viewvc?rev=677451&view=rev
Log:
merge for PIG-114 and PIG-118 into types branch

Added:
    incubator/pig/branches/types/src/org/apache/pig/ReversibleLoadStoreFunc.java
Modified:
    incubator/pig/branches/types/src/org/apache/pig/builtin/BinStorage.java
    incubator/pig/branches/types/src/org/apache/pig/builtin/PigStorage.java
    incubator/pig/branches/types/src/org/apache/pig/impl/logicalLayer/parser/QueryParser.jjt

Added: incubator/pig/branches/types/src/org/apache/pig/ReversibleLoadStoreFunc.java
URL: http://svn.apache.org/viewvc/incubator/pig/branches/types/src/org/apache/pig/ReversibleLoadStoreFunc.java?rev=677451&view=auto
==============================================================================
--- incubator/pig/branches/types/src/org/apache/pig/ReversibleLoadStoreFunc.java (added)
+++ incubator/pig/branches/types/src/org/apache/pig/ReversibleLoadStoreFunc.java Wed Jul 16 15:33:18 2008
@@ -0,0 +1,14 @@
+package org.apache.pig;
+
+/**
+ * This interface is used to implement classes that can perform both
+ * Load and Store functionalities in a symmetric fashion (thus reversible). 
+ * 
+ * The symmetry property of implementations is used in the optimization
+ * engine therefore violation of this property while implementing this 
+ * interface is likely to result in unexpected output from executions.
+ * 
+ */
+public interface ReversibleLoadStoreFunc extends LoadFunc, StoreFunc {
+
+}

Modified: incubator/pig/branches/types/src/org/apache/pig/builtin/BinStorage.java
URL: http://svn.apache.org/viewvc/incubator/pig/branches/types/src/org/apache/pig/builtin/BinStorage.java?rev=677451&r1=677450&r2=677451&view=diff
==============================================================================
--- incubator/pig/branches/types/src/org/apache/pig/builtin/BinStorage.java (original)
+++ incubator/pig/branches/types/src/org/apache/pig/builtin/BinStorage.java Wed Jul 16 15:33:18 2008
@@ -27,8 +27,7 @@
 import java.util.Iterator;
 import java.util.Map;
 
-import org.apache.pig.LoadFunc;
-import org.apache.pig.StoreFunc;
+import org.apache.pig.ReversibleLoadStoreFunc;
 import org.apache.pig.backend.executionengine.ExecException;
 import org.apache.pig.data.DataBag;
 import org.apache.pig.data.DataReaderWriter;
@@ -37,7 +36,7 @@
 import org.apache.pig.impl.logicalLayer.schema.Schema;
 
 
-public class BinStorage implements LoadFunc, StoreFunc {
+public class BinStorage implements ReversibleLoadStoreFunc {
     public static final byte RECORD_1 = 0x21;
     public static final byte RECORD_2 = 0x31;
     public static final byte RECORD_3 = 0x41;

Modified: incubator/pig/branches/types/src/org/apache/pig/builtin/PigStorage.java
URL: http://svn.apache.org/viewvc/incubator/pig/branches/types/src/org/apache/pig/builtin/PigStorage.java?rev=677451&r1=677450&r2=677451&view=diff
==============================================================================
--- incubator/pig/branches/types/src/org/apache/pig/builtin/PigStorage.java (original)
+++ incubator/pig/branches/types/src/org/apache/pig/builtin/PigStorage.java Wed Jul 16 15:33:18 2008
@@ -26,6 +26,7 @@
 
 import org.apache.pig.LoadFunc;
 import org.apache.pig.StoreFunc;
+import org.apache.pig.ReversibleLoadStoreFunc;
 import org.apache.pig.backend.executionengine.ExecException;
 import org.apache.pig.data.DataByteArray;
 import org.apache.pig.data.DataType;
@@ -34,14 +35,13 @@
 import org.apache.pig.impl.io.BufferedPositionedInputStream;
 import org.apache.pig.impl.logicalLayer.schema.Schema;
 
-
 /**
  * A load function that parses a line of input into fields using a delimiter to set the fields. The
  * delimiter is given as a regular expression. See String.split(delimiter) and
  * http://java.sun.com/j2se/1.5.0/docs/api/java/util/regex/Pattern.html for more information.
  */
 public class PigStorage extends Utf8StorageConverter
-        implements LoadFunc, StoreFunc {
+        implements ReversibleLoadStoreFunc {
     protected BufferedPositionedInputStream in = null;
         
     long                end            = Long.MAX_VALUE;

Modified: incubator/pig/branches/types/src/org/apache/pig/impl/logicalLayer/parser/QueryParser.jjt
URL: http://svn.apache.org/viewvc/incubator/pig/branches/types/src/org/apache/pig/impl/logicalLayer/parser/QueryParser.jjt?rev=677451&r1=677450&r2=677451&view=diff
==============================================================================
--- incubator/pig/branches/types/src/org/apache/pig/impl/logicalLayer/parser/QueryParser.jjt (original)
+++ incubator/pig/branches/types/src/org/apache/pig/impl/logicalLayer/parser/QueryParser.jjt Wed Jul 16 15:33:18 2008
@@ -1216,7 +1216,7 @@
 {
 	(
 	op = NestedExpr(lp) { inputs.add(op); }
-	("," op = NestedExpr(lp) { inputs.add(op); })*
+	("," op = NestedExpr(lp) { inputs.add(op); })+
 	)
 	{
 		LogicalOperator cross = new LOCross(lp, new OperatorKey(scope, getNextId()));
@@ -1243,7 +1243,7 @@
 }
 {
 	(gi = GroupItem(lp) { gis.add(gi); }
-	("," gi = GroupItem(lp) { gis.add(gi); })*)
+	("," gi = GroupItem(lp) { gis.add(gi); })+)
 	{log.trace("Exiting JoinClause"); return rewriteJoin(gis, lp);}
 	
 }
@@ -1256,7 +1256,7 @@
 }
 {
 	(op = NestedExpr(lp){inputs.add(op);} 
-	("," op = NestedExpr(lp) {inputs.add(op);})*)
+	("," op = NestedExpr(lp) {inputs.add(op);})+)
 	{
 		LogicalOperator union = new LOUnion(lp, new OperatorKey(scope, getNextId()));
 		lp.add(union);