Author: pradeepkth
Date: Tue Aug 17 20:41:53 2010
New Revision: 986478

URL: http://svn.apache.org/viewvc?rev=986478&view=rev
Log:
PIG-1546: Incorrect assert statements in operator evaluation (ajaykidave via 
pradeepkth)

Modified:
    hadoop/pig/trunk/CHANGES.txt
    hadoop/pig/trunk/build.xml
    
hadoop/pig/trunk/src/org/apache/pig/backend/hadoop/executionengine/physicalLayer/expressionOperators/GTOrEqualToExpr.java
    
hadoop/pig/trunk/src/org/apache/pig/backend/hadoop/executionengine/physicalLayer/expressionOperators/GreaterThanExpr.java
    
hadoop/pig/trunk/src/org/apache/pig/backend/hadoop/executionengine/physicalLayer/expressionOperators/LTOrEqualToExpr.java
    
hadoop/pig/trunk/src/org/apache/pig/backend/hadoop/executionengine/physicalLayer/expressionOperators/LessThanExpr.java
    hadoop/pig/trunk/test/org/apache/pig/test/TestLocal2.java

Modified: hadoop/pig/trunk/CHANGES.txt
URL: 
http://svn.apache.org/viewvc/hadoop/pig/trunk/CHANGES.txt?rev=986478&r1=986477&r2=986478&view=diff
==============================================================================
--- hadoop/pig/trunk/CHANGES.txt (original)
+++ hadoop/pig/trunk/CHANGES.txt Tue Aug 17 20:41:53 2010
@@ -129,6 +129,9 @@ PIG-1309: Map-side Cogroup (ashutoshc)
 
 BUG FIXES
 
+PIG-1546: Incorrect assert statements in operator evaluation (ajaykidave via
+pradeepkth)
+
 PIG-1392: Parser fails to recognize valid field (niraj via rding)
 
 PIG-1541: FR Join shouldn't match null values (rding)

Modified: hadoop/pig/trunk/build.xml
URL: 
http://svn.apache.org/viewvc/hadoop/pig/trunk/build.xml?rev=986478&r1=986477&r2=986478&view=diff
==============================================================================
--- hadoop/pig/trunk/build.xml (original)
+++ hadoop/pig/trunk/build.xml Tue Aug 17 20:41:53 2010
@@ -615,6 +615,11 @@
             <batchtest fork="yes" todir="${test.log.dir}" if="testcase">
                 <fileset dir="test" includes="**/${testcase}.java"/>
             </batchtest>
+
+            <assertions>
+                <enable />
+            </assertions>
+
         </junit>
         <delete dir="${junit.tmp.dir}/"/>
         <fail if="tests.failed">Tests failed!</fail>

Modified: 
hadoop/pig/trunk/src/org/apache/pig/backend/hadoop/executionengine/physicalLayer/expressionOperators/GTOrEqualToExpr.java
URL: 
http://svn.apache.org/viewvc/hadoop/pig/trunk/src/org/apache/pig/backend/hadoop/executionengine/physicalLayer/expressionOperators/GTOrEqualToExpr.java?rev=986478&r1=986477&r2=986478&view=diff
==============================================================================
--- 
hadoop/pig/trunk/src/org/apache/pig/backend/hadoop/executionengine/physicalLayer/expressionOperators/GTOrEqualToExpr.java
 (original)
+++ 
hadoop/pig/trunk/src/org/apache/pig/backend/hadoop/executionengine/physicalLayer/expressionOperators/GTOrEqualToExpr.java
 Tue Aug 17 20:41:53 2010
@@ -147,8 +147,8 @@ public class GTOrEqualToExpr extends Bin
             left.returnStatus = POStatus.STATUS_NULL;
             return left;
         }
-        assert(left instanceof Comparable);
-        assert(right instanceof Comparable);
+        assert(left.result instanceof Comparable);
+        assert(right.result instanceof Comparable);
         if (((Comparable)left.result).compareTo((Comparable)right.result) >= 
0) {
             left.result = trueRef;
         } else {

Modified: 
hadoop/pig/trunk/src/org/apache/pig/backend/hadoop/executionengine/physicalLayer/expressionOperators/GreaterThanExpr.java
URL: 
http://svn.apache.org/viewvc/hadoop/pig/trunk/src/org/apache/pig/backend/hadoop/executionengine/physicalLayer/expressionOperators/GreaterThanExpr.java?rev=986478&r1=986477&r2=986478&view=diff
==============================================================================
--- 
hadoop/pig/trunk/src/org/apache/pig/backend/hadoop/executionengine/physicalLayer/expressionOperators/GreaterThanExpr.java
 (original)
+++ 
hadoop/pig/trunk/src/org/apache/pig/backend/hadoop/executionengine/physicalLayer/expressionOperators/GreaterThanExpr.java
 Tue Aug 17 20:41:53 2010
@@ -147,8 +147,8 @@ public class GreaterThanExpr extends Bin
             left.returnStatus = POStatus.STATUS_NULL;
             return left;
         }
-        assert(left instanceof Comparable);
-        assert(right instanceof Comparable);
+        assert(left.result instanceof Comparable);
+        assert(right.result instanceof Comparable);
         if (((Comparable)left.result).compareTo((Comparable)right.result) > 0) 
{
             left.result = trueRef;
         } else {

Modified: 
hadoop/pig/trunk/src/org/apache/pig/backend/hadoop/executionengine/physicalLayer/expressionOperators/LTOrEqualToExpr.java
URL: 
http://svn.apache.org/viewvc/hadoop/pig/trunk/src/org/apache/pig/backend/hadoop/executionengine/physicalLayer/expressionOperators/LTOrEqualToExpr.java?rev=986478&r1=986477&r2=986478&view=diff
==============================================================================
--- 
hadoop/pig/trunk/src/org/apache/pig/backend/hadoop/executionengine/physicalLayer/expressionOperators/LTOrEqualToExpr.java
 (original)
+++ 
hadoop/pig/trunk/src/org/apache/pig/backend/hadoop/executionengine/physicalLayer/expressionOperators/LTOrEqualToExpr.java
 Tue Aug 17 20:41:53 2010
@@ -147,8 +147,8 @@ public class LTOrEqualToExpr extends Bin
             left.returnStatus = POStatus.STATUS_NULL;
             return left;
         }
-        assert(left instanceof Comparable);
-        assert(right instanceof Comparable);
+        assert(left.result instanceof Comparable);
+        assert(right.result instanceof Comparable);
         if (((Comparable)left.result).compareTo((Comparable)right.result) <= 
0) {
             left.result = trueRef;
         } else {

Modified: 
hadoop/pig/trunk/src/org/apache/pig/backend/hadoop/executionengine/physicalLayer/expressionOperators/LessThanExpr.java
URL: 
http://svn.apache.org/viewvc/hadoop/pig/trunk/src/org/apache/pig/backend/hadoop/executionengine/physicalLayer/expressionOperators/LessThanExpr.java?rev=986478&r1=986477&r2=986478&view=diff
==============================================================================
--- 
hadoop/pig/trunk/src/org/apache/pig/backend/hadoop/executionengine/physicalLayer/expressionOperators/LessThanExpr.java
 (original)
+++ 
hadoop/pig/trunk/src/org/apache/pig/backend/hadoop/executionengine/physicalLayer/expressionOperators/LessThanExpr.java
 Tue Aug 17 20:41:53 2010
@@ -147,8 +147,8 @@ public class LessThanExpr extends Binary
             left.returnStatus = POStatus.STATUS_NULL;
             return left;
         }
-        assert(left instanceof Comparable);
-        assert(right instanceof Comparable);
+        assert(left.result instanceof Comparable);
+        assert(right.result instanceof Comparable);
         if (((Comparable)left.result).compareTo((Comparable)right.result) < 0) 
{
             left.result = trueRef;
         } else {

Modified: hadoop/pig/trunk/test/org/apache/pig/test/TestLocal2.java
URL: 
http://svn.apache.org/viewvc/hadoop/pig/trunk/test/org/apache/pig/test/TestLocal2.java?rev=986478&r1=986477&r2=986478&view=diff
==============================================================================
--- hadoop/pig/trunk/test/org/apache/pig/test/TestLocal2.java (original)
+++ hadoop/pig/trunk/test/org/apache/pig/test/TestLocal2.java Tue Aug 17 
20:41:53 2010
@@ -158,6 +158,33 @@ public class TestLocal2 extends TestCase
         fp1.delete();
         
     }
+
+    @Test
+    public void testOperatorLocal() throws Exception {
+        // Regression test for PIG-1546
+        File fp1 = File.createTempFile("opTest", "txt");
+        PrintStream ps = new PrintStream(new FileOutputStream(fp1));
+        
+        ps.println("1\t2");
+        ps.close();
+        
+        pig.registerQuery("A = load '"
+                + Util.generateURI(fp1.toString(), pig.getPigContext())
+                + "' AS (c1:int, c2:int); ");
+        pig.registerQuery("B = filter A by c1 > 0;");
+        pig.registerQuery("C = filter B by c1 < 2;");
+        pig.registerQuery("D = filter C by c1 >= 0;");
+        pig.registerQuery("E = filter D by c1 <= 2;");
+        
+        Iterator<Tuple> iter = pig.openIterator("E");
+        assertTrue(iter.hasNext());
+        Tuple t = iter.next();
+        assertTrue(t.get(0).equals(new Integer(1)));
+        assertTrue(t.get(1).equals(new Integer(2)));
+        assertFalse(iter.hasNext());
+
+        fp1.delete();
+    }
     
     @Test
     public void testJoin1() throws Exception {


Reply via email to