Author: gates
Date: Mon Aug 11 17:02:29 2008
New Revision: 684992

URL: http://svn.apache.org/viewvc?rev=684992&view=rev
Log:
PIG-341 Daniel's patch to remove unecessary sort...limit syntax.


Removed:
    
incubator/pig/branches/types/test/org/apache/pig/test/data/GoldenFiles/LimitedSort.gld
Modified:
    
incubator/pig/branches/types/src/org/apache/pig/impl/logicalLayer/parser/QueryParser.jjt
    
incubator/pig/branches/types/test/org/apache/pig/test/TestLogToPhyCompiler.java
    
incubator/pig/branches/types/test/org/apache/pig/test/TestLogicalPlanBuilder.java

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=684992&r1=684991&r2=684992&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
 Mon Aug 11 17:02:29 2008
@@ -1206,7 +1206,6 @@
        ArrayList<Boolean> ascOrder = new ArrayList<Boolean>(); 
        boolean asc = true; 
        String funcName = null; 
-       long limit=-1;
        Token t1;
        log.trace("Entering OrderClause");
 }
@@ -1235,7 +1234,6 @@
                        }
                }       
        )
-       (<LIMIT> t1 = <INTEGER> { limit = Integer.parseInt(t1.image);})?
        (
         <USING>  funcName = QualifiedFunction()
     )?
@@ -1245,7 +1243,7 @@
                LOSort sort = new LOSort(lp, new OperatorKey(scope, 
getNextId()), sortColPlans, ascOrder, 
                                          (funcName != null ? new 
FuncSpec(funcName) : null));
                sort.setStar(star);
-               sort.setLimit(limit);
+               sort.setLimit(-1);
                lp.add(sort);
                log.debug("Added operator " + sort.getClass().getName() + " to 
the logical plan");
                

Modified: 
incubator/pig/branches/types/test/org/apache/pig/test/TestLogToPhyCompiler.java
URL: 
http://svn.apache.org/viewvc/incubator/pig/branches/types/test/org/apache/pig/test/TestLogToPhyCompiler.java?rev=684992&r1=684991&r2=684992&view=diff
==============================================================================
--- 
incubator/pig/branches/types/test/org/apache/pig/test/TestLogToPhyCompiler.java 
(original)
+++ 
incubator/pig/branches/types/test/org/apache/pig/test/TestLogToPhyCompiler.java 
Mon Aug 11 17:02:29 2008
@@ -512,36 +512,6 @@
         assertEquals(compiledPlan, goldenPlan);
     }
 
-    @Test
-    public void testLimitedSort() throws VisitorException, IOException {
-        String query = "Order (load 'a') by $0 limit 5;";
-        LogicalPlan plan = buildPlan(query);
-        PhysicalPlan pp = buildPhysicalPlan(plan);
-
-        int MAX_SIZE = 100000;
-        ByteArrayOutputStream baos = new ByteArrayOutputStream();
-        pp.explain(baos);
-        String compiledPlan = baos.toString();
-
-        if(generate){
-            FileOutputStream fos = new 
FileOutputStream("test/org/apache/pig/test/data/GoldenFiles/LimitedSort.gld");
-            fos.write(baos.toByteArray());
-            return;
-        }
-        
-        FileInputStream fis = new 
FileInputStream("test/org/apache/pig/test/data/GoldenFiles/LimitedSort.gld");
-        byte[] b = new byte[MAX_SIZE];
-        int len = fis.read(b);
-        String goldenPlan = new String(b, 0, len);
-
-        System.out.println();
-        System.out.println(compiledPlan);
-        System.out.println("-------------");
-
-        //System.out.println(compiledPlan.compareTo(goldenPlan)==0);
-        assertEquals(compiledPlan, goldenPlan);
-    }
-
     
     /[EMAIL PROTECTED]
     public void testUserFunc() throws VisitorException {

Modified: 
incubator/pig/branches/types/test/org/apache/pig/test/TestLogicalPlanBuilder.java
URL: 
http://svn.apache.org/viewvc/incubator/pig/branches/types/test/org/apache/pig/test/TestLogicalPlanBuilder.java?rev=684992&r1=684991&r2=684992&view=diff
==============================================================================
--- 
incubator/pig/branches/types/test/org/apache/pig/test/TestLogicalPlanBuilder.java
 (original)
+++ 
incubator/pig/branches/types/test/org/apache/pig/test/TestLogicalPlanBuilder.java
 Mon Aug 11 17:02:29 2008
@@ -947,12 +947,6 @@
     }
     
     @Test
-    public void testQuery78() {
-        buildPlan("a = load 'a';");
-        buildPlan("b = order a by $0 limit 100;");
-    }
-    
-    @Test
     public void testQuery75() {
         buildPlan("a = union (load 'a'), (load 'b'), (load 'c');");
         buildPlan("b = foreach a {generate $0;} parallel 10;");


Reply via email to