Author: gates
Date: Thu Jul  3 15:57:30 2008
New Revision: 673858

URL: http://svn.apache.org/viewvc?rev=673858&view=rev
Log:
PIG-162 Fixed bug in POBinCond that was causing it not to forward errors 
(contributed by Shravan).  Fixed issue in DataType conversion from hadoop's
BytesWritable to use size() instead of length.


Modified:
    incubator/pig/branches/types/src/org/apache/pig/data/DataType.java
    
incubator/pig/branches/types/src/org/apache/pig/impl/physicalLayer/expressionOperators/POBinCond.java
    
incubator/pig/branches/types/test/org/apache/pig/test/data/GoldenFiles/BinCond.gld
    
incubator/pig/branches/types/test/org/apache/pig/test/data/GoldenFiles/Comparison.gld
    
incubator/pig/branches/types/test/org/apache/pig/test/data/GoldenFiles/ComplexForeach.gld
    
incubator/pig/branches/types/test/org/apache/pig/test/data/GoldenFiles/Split1.gld
    
incubator/pig/branches/types/test/org/apache/pig/test/data/GoldenFiles/Split2.gld

Modified: incubator/pig/branches/types/src/org/apache/pig/data/DataType.java
URL: 
http://svn.apache.org/viewvc/incubator/pig/branches/types/src/org/apache/pig/data/DataType.java?rev=673858&r1=673857&r2=673858&view=diff
==============================================================================
--- incubator/pig/branches/types/src/org/apache/pig/data/DataType.java 
(original)
+++ incubator/pig/branches/types/src/org/apache/pig/data/DataType.java Thu Jul  
3 15:57:30 2008
@@ -375,8 +375,10 @@
             return key;
         if (key instanceof BooleanWritable)
             return ((BooleanWritable) key).get();
-        if (key instanceof BytesWritable)
-            return new DataByteArray(((BytesWritable) key).get());
+        if (key instanceof BytesWritable) {
+            return new DataByteArray(((BytesWritable) key).get(), 0,
+                ((BytesWritable)key).getSize());
+        }
         if (key instanceof Text)
             return ((Text) key).toString();
         if (key instanceof FloatWritable)

Modified: 
incubator/pig/branches/types/src/org/apache/pig/impl/physicalLayer/expressionOperators/POBinCond.java
URL: 
http://svn.apache.org/viewvc/incubator/pig/branches/types/src/org/apache/pig/impl/physicalLayer/expressionOperators/POBinCond.java?rev=673858&r1=673857&r2=673858&view=diff
==============================================================================
--- 
incubator/pig/branches/types/src/org/apache/pig/impl/physicalLayer/expressionOperators/POBinCond.java
 (original)
+++ 
incubator/pig/branches/types/src/org/apache/pig/impl/physicalLayer/expressionOperators/POBinCond.java
 Thu Jul  3 15:57:30 2008
@@ -24,6 +24,7 @@
 import org.apache.pig.data.DataByteArray;
 import org.apache.pig.data.DataType;
 import org.apache.pig.data.Tuple;
+import org.apache.pig.impl.physicalLayer.POStatus;
 import org.apache.pig.impl.physicalLayer.Result;
 import org.apache.pig.impl.physicalLayer.plans.PhyPlanVisitor;
 import org.apache.pig.impl.plan.OperatorKey;
@@ -59,6 +60,7 @@
     @Override
     public Result getNext(Boolean b) throws ExecException {
         Result res = cond.getNext(b);
+        if (res.returnStatus != POStatus.STATUS_OK) return res;
         return ((Boolean)res.result) == true ? lhs.getNext(b) : rhs.getNext(b);
         
     }
@@ -66,54 +68,63 @@
     @Override
     public Result getNext(DataBag db) throws ExecException {
         Result res = cond.getNext(dummyBool);
+        if (res.returnStatus != POStatus.STATUS_OK) return res;
         return ((Boolean)res.result) == true ? lhs.getNext(db) : 
rhs.getNext(db);
     }
 
     @Override
     public Result getNext(DataByteArray ba) throws ExecException {
         Result res = cond.getNext(dummyBool);
+        if (res.returnStatus != POStatus.STATUS_OK) return res;
         return ((Boolean)res.result) == true ? lhs.getNext(ba) : 
rhs.getNext(ba);
     }
 
     @Override
     public Result getNext(Double d) throws ExecException {
         Result res = cond.getNext(dummyBool);
+        if (res.returnStatus != POStatus.STATUS_OK) return res;
         return ((Boolean)res.result) == true ? lhs.getNext(d) : rhs.getNext(d);
     }
 
     @Override
     public Result getNext(Float f) throws ExecException {
         Result res = cond.getNext(dummyBool);
+        if (res.returnStatus != POStatus.STATUS_OK) return res;
         return ((Boolean)res.result) == true ? lhs.getNext(f) : rhs.getNext(f);
     }
 
     @Override
     public Result getNext(Integer i) throws ExecException {
         Result res = cond.getNext(dummyBool);
+        if (res.returnStatus != POStatus.STATUS_OK) return res;
         return ((Boolean)res.result) == true ? lhs.getNext(i) : rhs.getNext(i);
     }
 
     @Override
     public Result getNext(Long l) throws ExecException {
         Result res = cond.getNext(dummyBool);
+        if (res.returnStatus != POStatus.STATUS_OK) return res;
         return ((Boolean)res.result) == true ? lhs.getNext(l) : rhs.getNext(l);
     }
 
     @Override
     public Result getNext(Map m) throws ExecException {
         Result res = cond.getNext(dummyBool);
+        if (res.returnStatus != POStatus.STATUS_OK) return res;
         return ((Boolean)res.result) == true ? lhs.getNext(m) : rhs.getNext(m);
     }
 
     @Override
     public Result getNext(String s) throws ExecException {
         Result res = cond.getNext(dummyBool);
+        if (res.returnStatus != POStatus.STATUS_OK) return res;
         return ((Boolean)res.result) == true ? lhs.getNext(s) : rhs.getNext(s);
     }
 
     @Override
     public Result getNext(Tuple t) throws ExecException {
         Result res = cond.getNext(dummyBool);
+        if (res.returnStatus != POStatus.STATUS_OK) return res;
         return ((Boolean)res.result) == true ? lhs.getNext(t) : rhs.getNext(t);
     }
 

Modified: 
incubator/pig/branches/types/test/org/apache/pig/test/data/GoldenFiles/BinCond.gld
URL: 
http://svn.apache.org/viewvc/incubator/pig/branches/types/test/org/apache/pig/test/data/GoldenFiles/BinCond.gld?rev=673858&r1=673857&r2=673858&view=diff
==============================================================================
--- 
incubator/pig/branches/types/test/org/apache/pig/test/data/GoldenFiles/BinCond.gld
 (original)
+++ 
incubator/pig/branches/types/test/org/apache/pig/test/data/GoldenFiles/BinCond.gld
 Thu Jul  3 15:57:30 2008
@@ -2,7 +2,7 @@
 |   |
 |   POBinCond[Unknown] - Test-Plan-Builder-136
 |   |
-|   |---Equal To[tuple] - Test-Plan-Builder-129
+|   |---Equal To[boolean] - Test-Plan-Builder-129
 |   |   |
 |   |   |---Project[bytearray][1] - Test-Plan-Builder-127
 |   |   |

Modified: 
incubator/pig/branches/types/test/org/apache/pig/test/data/GoldenFiles/Comparison.gld
URL: 
http://svn.apache.org/viewvc/incubator/pig/branches/types/test/org/apache/pig/test/data/GoldenFiles/Comparison.gld?rev=673858&r1=673857&r2=673858&view=diff
==============================================================================
--- 
incubator/pig/branches/types/test/org/apache/pig/test/data/GoldenFiles/Comparison.gld
 (original)
+++ 
incubator/pig/branches/types/test/org/apache/pig/test/data/GoldenFiles/Comparison.gld
 Thu Jul  3 15:57:30 2008
@@ -1,6 +1,6 @@
 Filter[bag] - Test-Plan-Builder-101
 |   |
-|   Greater Than[tuple] - Test-Plan-Builder-112
+|   Greater Than[boolean] - Test-Plan-Builder-112
 |   |
 |   |---Add[Unknown] - Test-Plan-Builder-104
 |   |   |

Modified: 
incubator/pig/branches/types/test/org/apache/pig/test/data/GoldenFiles/ComplexForeach.gld
URL: 
http://svn.apache.org/viewvc/incubator/pig/branches/types/test/org/apache/pig/test/data/GoldenFiles/ComplexForeach.gld?rev=673858&r1=673857&r2=673858&view=diff
==============================================================================
--- 
incubator/pig/branches/types/test/org/apache/pig/test/data/GoldenFiles/ComplexForeach.gld
 (original)
+++ 
incubator/pig/branches/types/test/org/apache/pig/test/data/GoldenFiles/ComplexForeach.gld
 Thu Jul  3 15:57:30 2008
@@ -4,7 +4,7 @@
 |   |
 |   |---Filter[bag] - Test-Plan-Builder-11
 |       |   |
-|       |   Equal To[tuple] - Test-Plan-Builder-14
+|       |   Equal To[boolean] - Test-Plan-Builder-14
 |       |   |
 |       |   |---Project[bytearray][1] - Test-Plan-Builder-12
 |       |   |

Modified: 
incubator/pig/branches/types/test/org/apache/pig/test/data/GoldenFiles/Split1.gld
URL: 
http://svn.apache.org/viewvc/incubator/pig/branches/types/test/org/apache/pig/test/data/GoldenFiles/Split1.gld?rev=673858&r1=673857&r2=673858&view=diff
==============================================================================
--- 
incubator/pig/branches/types/test/org/apache/pig/test/data/GoldenFiles/Split1.gld
 (original)
+++ 
incubator/pig/branches/types/test/org/apache/pig/test/data/GoldenFiles/Split1.gld
 Thu Jul  3 15:57:30 2008
@@ -1,6 +1,6 @@
 Filter[tuple] - Test-Plan-Builder-196
 |   |
-|   Greater Than[tuple] - Test-Plan-Builder-199
+|   Greater Than[boolean] - Test-Plan-Builder-199
 |   |
 |   |---Project[bytearray][0] - Test-Plan-Builder-197
 |   |
@@ -12,7 +12,7 @@
 
 Filter[tuple] - Test-Plan-Builder-200
 |   |
-|   Less Than[tuple] - Test-Plan-Builder-203
+|   Less Than[boolean] - Test-Plan-Builder-203
 |   |
 |   |---Project[bytearray][0] - Test-Plan-Builder-201
 |   |

Modified: 
incubator/pig/branches/types/test/org/apache/pig/test/data/GoldenFiles/Split2.gld
URL: 
http://svn.apache.org/viewvc/incubator/pig/branches/types/test/org/apache/pig/test/data/GoldenFiles/Split2.gld?rev=673858&r1=673857&r2=673858&view=diff
==============================================================================
--- 
incubator/pig/branches/types/test/org/apache/pig/test/data/GoldenFiles/Split2.gld
 (original)
+++ 
incubator/pig/branches/types/test/org/apache/pig/test/data/GoldenFiles/Split2.gld
 Thu Jul  3 15:57:30 2008
@@ -1,6 +1,6 @@
 Filter[tuple] - Test-Plan-Builder-196
 |   |
-|   Greater Than[tuple] - Test-Plan-Builder-199
+|   Greater Than[boolean] - Test-Plan-Builder-199
 |   |
 |   |---Project[bytearray](0) - Test-Plan-Builder-197
 |   |
@@ -12,7 +12,7 @@
 
 Filter[tuple] - Test-Plan-Builder-200
 |   |
-|   Less Than[tuple] - Test-Plan-Builder-203
+|   Less Than[boolean] - Test-Plan-Builder-203
 |   |
 |   |---Project[bytearray](0) - Test-Plan-Builder-201
 |   |


Reply via email to