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/05/02 22:01:09 UTC
svn commit: r652883 - in /incubator/pig/trunk: CHANGES.txt
src/org/apache/pig/impl/logicalLayer/optimizer/streaming/LoadOptimizer.java
src/org/apache/pig/impl/logicalLayer/optimizer/streaming/StoreOptimizer.java
Author: olga
Date: Fri May 2 13:01:09 2008
New Revision: 652883
URL: http://svn.apache.org/viewvc?rev=652883&view=rev
Log:
Update for fix to PIG-226 to use ReversibleLoadStoreFunc
Modified:
incubator/pig/trunk/CHANGES.txt
incubator/pig/trunk/src/org/apache/pig/impl/logicalLayer/optimizer/streaming/LoadOptimizer.java
incubator/pig/trunk/src/org/apache/pig/impl/logicalLayer/optimizer/streaming/StoreOptimizer.java
Modified: incubator/pig/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/incubator/pig/trunk/CHANGES.txt?rev=652883&r1=652882&r2=652883&view=diff
==============================================================================
--- incubator/pig/trunk/CHANGES.txt (original)
+++ incubator/pig/trunk/CHANGES.txt Fri May 2 13:01:09 2008
@@ -258,5 +258,5 @@
PIG-222: fix build break
- PIG-226: fix for streaming optimization bug
+ PIG-226: fix for streaming optimization bug (acmurthy via olgan)
Modified: incubator/pig/trunk/src/org/apache/pig/impl/logicalLayer/optimizer/streaming/LoadOptimizer.java
URL: http://svn.apache.org/viewvc/incubator/pig/trunk/src/org/apache/pig/impl/logicalLayer/optimizer/streaming/LoadOptimizer.java?rev=652883&r1=652882&r2=652883&view=diff
==============================================================================
--- incubator/pig/trunk/src/org/apache/pig/impl/logicalLayer/optimizer/streaming/LoadOptimizer.java (original)
+++ incubator/pig/trunk/src/org/apache/pig/impl/logicalLayer/optimizer/streaming/LoadOptimizer.java Fri May 2 13:01:09 2008
@@ -17,9 +17,8 @@
*/
package org.apache.pig.impl.logicalLayer.optimizer.streaming;
-import java.util.List;
-
import org.apache.pig.LoadFunc;
+import org.apache.pig.ReversibleLoadStoreFunc;
import org.apache.pig.StoreFunc;
import org.apache.pig.builtin.BinaryStorage;
import org.apache.pig.impl.PigContext;
@@ -38,7 +37,6 @@
import org.apache.pig.impl.logicalLayer.LogicalPlan;
import org.apache.pig.impl.logicalLayer.optimizer.Optimizer;
import org.apache.pig.impl.streaming.StreamingCommand;
-import org.apache.pig.impl.streaming.StreamingCommand.Handle;
import org.apache.pig.impl.streaming.StreamingCommand.HandleSpec;
/**
@@ -83,14 +81,21 @@
loadFileSpec.getFuncSpec());
// Check if the streaming command's inputSpec also implements
- // LoadFunc and if it does, are they of the same type?
+ // LoadFunc and if it does, are they of the same _reversible_
+ // type?
boolean sameType = false;
try {
- // TODO: We should actually check if the streamStorer
- // is _reversible_ as the inputLoader ...
+ // Check if the streamStorer is _reversible_ as
+ // the inputLoader ...
if (streamStorer instanceof LoadFunc) {
+ // Cast to check if they are of the same type...
streamStorer.getClass().cast(inputLoader);
- sameType = true;
+
+ // Now check if they both are reversible...
+ if (streamStorer instanceof ReversibleLoadStoreFunc &&
+ inputLoader instanceof ReversibleLoadStoreFunc) {
+ sameType = true;
+ }
}
} catch (ClassCastException cce) {
sameType = false;
Modified: incubator/pig/trunk/src/org/apache/pig/impl/logicalLayer/optimizer/streaming/StoreOptimizer.java
URL: http://svn.apache.org/viewvc/incubator/pig/trunk/src/org/apache/pig/impl/logicalLayer/optimizer/streaming/StoreOptimizer.java?rev=652883&r1=652882&r2=652883&view=diff
==============================================================================
--- incubator/pig/trunk/src/org/apache/pig/impl/logicalLayer/optimizer/streaming/StoreOptimizer.java (original)
+++ incubator/pig/trunk/src/org/apache/pig/impl/logicalLayer/optimizer/streaming/StoreOptimizer.java Fri May 2 13:01:09 2008
@@ -17,9 +17,8 @@
*/
package org.apache.pig.impl.logicalLayer.optimizer.streaming;
-import java.util.List;
-
import org.apache.pig.LoadFunc;
+import org.apache.pig.ReversibleLoadStoreFunc;
import org.apache.pig.StoreFunc;
import org.apache.pig.builtin.BinaryStorage;
import org.apache.pig.impl.PigContext;
@@ -38,7 +37,6 @@
import org.apache.pig.impl.logicalLayer.LogicalPlan;
import org.apache.pig.impl.logicalLayer.optimizer.Optimizer;
import org.apache.pig.impl.streaming.StreamingCommand;
-import org.apache.pig.impl.streaming.StreamingCommand.Handle;
import org.apache.pig.impl.streaming.StreamingCommand.HandleSpec;
/**
@@ -109,14 +107,21 @@
// Check if the streaming command's outputSpec also implements
- // StoreFunc and if it does, are they of the same type?
+ // StoreFunc and if it does, are they of the same _reversible_
+ // type?
boolean sameType = false;
try {
- // TODO: We should actually check if the streamLoader
- // is _reversible_ as the outputStorer ...
+ // Check if the streamLoader is _reversible_ as
+ // the outputStorer ...
if (streamLoader instanceof StoreFunc) {
+ // Cast to check if they are of the same type...
streamLoader.getClass().cast(outputStorer);
- sameType = true;
+
+ // Now check if they both are reversible...
+ if (streamLoader instanceof ReversibleLoadStoreFunc &&
+ outputStorer instanceof ReversibleLoadStoreFunc) {
+ sameType = true;
+ }
}
} catch (ClassCastException cce) {
sameType = false;