Review Board 1.7.22


PIG-2167 - Naive implementation of CUBE operator

Review Request #4670 - Created April 6, 2012 and updated

Prasanth_J
PIG-2167
Reviewers
pig
dvryaboy
pig
This is a review board for https://issues.apache.org/jira/browse/PIG-2167
Unit tests: All passed

Pre-commit tests: All passed
ant clean test-commit

Diff revision 3 (Latest)

1 2 3
1 2 3

  1. http://svn.apache.org/repos/asf/pig/trunk/src/org/apache/pig/newplan/logical/optimizer/AllExpressionVisitor.java: Loading...
  2. http://svn.apache.org/repos/asf/pig/trunk/src/org/apache/pig/newplan/logical/optimizer/SchemaResetter.java: Loading...
  3. http://svn.apache.org/repos/asf/pig/trunk/src/org/apache/pig/newplan/logical/relational/LOCube.java: Loading...
  4. http://svn.apache.org/repos/asf/pig/trunk/src/org/apache/pig/newplan/logical/relational/LogicalRelationalNodesVisitor.java: Loading...
  5. http://svn.apache.org/repos/asf/pig/trunk/src/org/apache/pig/newplan/logical/visitor/ProjectStarExpander.java: Loading...
  6. http://svn.apache.org/repos/asf/pig/trunk/src/org/apache/pig/parser/AliasMasker.g: Loading...
  7. http://svn.apache.org/repos/asf/pig/trunk/src/org/apache/pig/parser/AstPrinter.g: Loading...
  8. http://svn.apache.org/repos/asf/pig/trunk/src/org/apache/pig/parser/AstValidator.g: Loading...
  9. http://svn.apache.org/repos/asf/pig/trunk/src/org/apache/pig/parser/LogicalPlanBuilder.java: Loading...
  10. http://svn.apache.org/repos/asf/pig/trunk/src/org/apache/pig/parser/LogicalPlanGenerator.g: Loading...
  11. http://svn.apache.org/repos/asf/pig/trunk/src/org/apache/pig/parser/QueryLexer.g: Loading...
  12. http://svn.apache.org/repos/asf/pig/trunk/src/org/apache/pig/parser/QueryParser.g: Loading...
  13. http://svn.apache.org/repos/asf/pig/trunk/test/org/apache/pig/parser/TestLexer.pig: Loading...
  14. http://svn.apache.org/repos/asf/pig/trunk/test/org/apache/pig/parser/TestLogicalPlanGenerator.java: Loading...
  15. http://svn.apache.org/repos/asf/pig/trunk/test/org/apache/pig/parser/TestParser.pig: Loading...
  16. http://svn.apache.org/repos/asf/pig/trunk/test/org/apache/pig/parser/TestQueryLexer.java: Loading...
  17. http://svn.apache.org/repos/asf/pig/trunk/test/org/apache/pig/parser/TestQueryParser.java: Loading...
  18. http://svn.apache.org/repos/asf/pig/trunk/test/org/apache/pig/test/TestCubeOperator.java: Loading...
http://svn.apache.org/repos/asf/pig/trunk/src/org/apache/pig/newplan/logical/optimizer/AllExpressionVisitor.java
Revision 1334534 New Change
[20] 24 lines
[+20]
25
import org.apache.pig.newplan.OperatorPlan;
25
import org.apache.pig.newplan.OperatorPlan;
26
import org.apache.pig.newplan.PlanWalker;
26
import org.apache.pig.newplan.PlanWalker;
27
import org.apache.pig.newplan.logical.expression.LogicalExpressionPlan;
27
import org.apache.pig.newplan.logical.expression.LogicalExpressionPlan;
28
import org.apache.pig.newplan.logical.expression.LogicalExpressionVisitor;
28
import org.apache.pig.newplan.logical.expression.LogicalExpressionVisitor;
29
import org.apache.pig.newplan.logical.relational.LOCogroup;
29
import org.apache.pig.newplan.logical.relational.LOCogroup;

    
   
30
import org.apache.pig.newplan.logical.relational.LOCube;
30
import org.apache.pig.newplan.logical.relational.LOFilter;
31
import org.apache.pig.newplan.logical.relational.LOFilter;
31
import org.apache.pig.newplan.logical.relational.LOForEach;
32
import org.apache.pig.newplan.logical.relational.LOForEach;
32
import org.apache.pig.newplan.logical.relational.LOGenerate;
33
import org.apache.pig.newplan.logical.relational.LOGenerate;
33
import org.apache.pig.newplan.logical.relational.LOInnerLoad;
34
import org.apache.pig.newplan.logical.relational.LOInnerLoad;
34
import org.apache.pig.newplan.logical.relational.LOJoin;
35
import org.apache.pig.newplan.logical.relational.LOJoin;
[+20] [20] 27 lines
[+20]
62
     * @param expr LogicalExpressionPlan that will be visited
63
     * @param expr LogicalExpressionPlan that will be visited
63
     * @return a new LogicalExpressionVisitor for that expression
64
     * @return a new LogicalExpressionVisitor for that expression
64
     */
65
     */
65
    abstract protected LogicalExpressionVisitor getVisitor(LogicalExpressionPlan expr) throws FrontendException;
66
    abstract protected LogicalExpressionVisitor getVisitor(LogicalExpressionPlan expr) throws FrontendException;
66
    
67
    

    
   
68
    private void visitAll(Collection<LogicalExpressionPlan> lexpPlans) throws FrontendException {

    
   
69
	for (LogicalExpressionPlan plan : lexpPlans) {
Moved from 100

    
   
70
	    LogicalExpressionVisitor v = getVisitor(plan);
Moved from 101

    
   
71
	    v.visit();
Moved from 102

    
   
72
	}

    
   
73
    }

    
   
74
    
67
    @Override
75
    @Override
68
    public void visit(LOFilter filter) throws FrontendException {
76
    public void visit(LOFilter filter) throws FrontendException {
69
        currentOp = filter;
77
        currentOp = filter;
70
        LogicalExpressionVisitor v = getVisitor(filter.getFilterPlan());
78
        LogicalExpressionVisitor v = getVisitor(filter.getFilterPlan());
71
        v.visit();
79
        v.visit();
[+20] [20] 9 lines
[+20] [+] public void visit(LOLimit limit) throws FrontendException {
81
    }
89
    }
82
 
90
 
83
    @Override
91
    @Override
84
    public void visit(LOJoin join) throws FrontendException {
92
    public void visit(LOJoin join) throws FrontendException {
85
        currentOp = join;
93
        currentOp = join;
86
        Collection<LogicalExpressionPlan> c = join.getExpressionPlanValues();
94
        visitAll(join.getExpressionPlanValues());
87
        for (LogicalExpressionPlan plan : c) {
95
    }
88
            LogicalExpressionVisitor v = getVisitor(plan);
96
    
89
            v.visit();
97
    @Override

    
   
98
    public void visit(LOCube cu) throws FrontendException {

    
   
99
	currentOp = cu;

    
   
100
	MultiMap<Integer, LogicalExpressionPlan> expressionPlans = cu.getExpressionPlans();

    
   
101
	for (Integer key : expressionPlans.keySet()) {

    
   
102
	    visitAll(expressionPlans.get(key));
90
        }
103
	}
91
    }
104
    }
92
    
105
    
93
    @Override
106
    @Override
94
    public void visit(LOCogroup cg) throws FrontendException {
107
    public void visit(LOCogroup cg) throws FrontendException {
95
        currentOp = cg;
108
        currentOp = cg;
96
        MultiMap<Integer, LogicalExpressionPlan> expressionPlans = cg.getExpressionPlans();
109
        MultiMap<Integer, LogicalExpressionPlan> expressionPlans = cg.getExpressionPlans();
97
        for( Integer key : expressionPlans.keySet() ) {
110
        for( Integer key : expressionPlans.keySet() ) {
98
            Collection<LogicalExpressionPlan> exprPlans = expressionPlans.get(key);
111
            visitAll(expressionPlans.get(key));
99
            for( LogicalExpressionPlan plan : exprPlans ) {

   
100
                LogicalExpressionVisitor v = getVisitor(plan);

   
101
                v.visit();

   
102
            }

   
103
        }
112
        }
104
    }
113
    }
105
    
114
    
106
    @Override
115
    @Override
107
    public void visit(LOForEach foreach) throws FrontendException {
116
    public void visit(LOForEach foreach) throws FrontendException {
[+20] [20] 8 lines
[+20] public void visit(LOCogroup cg) throws FrontendException {
116
    }
125
    }
117
    
126
    
118
    @Override
127
    @Override
119
    public void visit(LOGenerate gen ) throws FrontendException {
128
    public void visit(LOGenerate gen ) throws FrontendException {
120
        currentOp = gen;
129
        currentOp = gen;
121
        Collection<LogicalExpressionPlan> plans = gen.getOutputPlans();
130
        visitAll(gen.getOutputPlans());
122
        for( LogicalExpressionPlan plan : plans ) {

   
123
            LogicalExpressionVisitor v = getVisitor(plan);

   
124
            v.visit();

   
125
        }

   
126
    }
131
    }
127
    
132
    
128
    @Override
133
    @Override
129
    public void visit(LOInnerLoad load) throws FrontendException {
134
    public void visit(LOInnerLoad load) throws FrontendException {
130
        // the expression in LOInnerLoad contains info relative from LOForEach
135
        // the expression in LOInnerLoad contains info relative from LOForEach
[+20] [20] 13 lines
[+20] [+] public void visit(LOSplitOutput splitOutput) throws FrontendException {
144
    }
149
    }
145
    
150
    
146
    @Override
151
    @Override
147
    public void visit(LOSort sort) throws FrontendException {
152
    public void visit(LOSort sort) throws FrontendException {
148
        currentOp = sort;
153
        currentOp = sort;
149
        Collection<LogicalExpressionPlan> c = sort.getSortColPlans();
154
        visitAll(sort.getSortColPlans());
150
        for (LogicalExpressionPlan plan : c) {

   
151
            LogicalExpressionVisitor v = getVisitor(plan);

   
152
            v.visit();

   
153
        }

   
154
    }
155
    }
155
}
156
}
http://svn.apache.org/repos/asf/pig/trunk/src/org/apache/pig/newplan/logical/optimizer/SchemaResetter.java
Revision 1334534 New Change
 
http://svn.apache.org/repos/asf/pig/trunk/src/org/apache/pig/newplan/logical/relational/LOCube.java
New File
 
http://svn.apache.org/repos/asf/pig/trunk/src/org/apache/pig/newplan/logical/relational/LogicalRelationalNodesVisitor.java
Revision 1334534 New Change
 
http://svn.apache.org/repos/asf/pig/trunk/src/org/apache/pig/newplan/logical/visitor/ProjectStarExpander.java
Revision 1334534 New Change
 
http://svn.apache.org/repos/asf/pig/trunk/src/org/apache/pig/parser/AliasMasker.g
Revision 1334534 New Change
 
http://svn.apache.org/repos/asf/pig/trunk/src/org/apache/pig/parser/AstPrinter.g
Revision 1334534 New Change
 
http://svn.apache.org/repos/asf/pig/trunk/src/org/apache/pig/parser/AstValidator.g
Revision 1334534 New Change
 
http://svn.apache.org/repos/asf/pig/trunk/src/org/apache/pig/parser/LogicalPlanBuilder.java
Revision 1334534 New Change
 
http://svn.apache.org/repos/asf/pig/trunk/src/org/apache/pig/parser/LogicalPlanGenerator.g
Revision 1334534 New Change
 
http://svn.apache.org/repos/asf/pig/trunk/src/org/apache/pig/parser/QueryLexer.g
Revision 1334534 New Change
 
http://svn.apache.org/repos/asf/pig/trunk/src/org/apache/pig/parser/QueryParser.g
Revision 1334534 New Change
 
http://svn.apache.org/repos/asf/pig/trunk/test/org/apache/pig/parser/TestLexer.pig
Revision 1334534 New Change
 
http://svn.apache.org/repos/asf/pig/trunk/test/org/apache/pig/parser/TestLogicalPlanGenerator.java
Revision 1334534 New Change
 
http://svn.apache.org/repos/asf/pig/trunk/test/org/apache/pig/parser/TestParser.pig
Revision 1334534 New Change
 
http://svn.apache.org/repos/asf/pig/trunk/test/org/apache/pig/parser/TestQueryLexer.java
Revision 1334534 New Change
 
http://svn.apache.org/repos/asf/pig/trunk/test/org/apache/pig/parser/TestQueryParser.java
Revision 1334534 New Change
 
http://svn.apache.org/repos/asf/pig/trunk/test/org/apache/pig/test/TestCubeOperator.java
New File
 
  1. http://svn.apache.org/repos/asf/pig/trunk/src/org/apache/pig/newplan/logical/optimizer/AllExpressionVisitor.java: Loading...
  2. http://svn.apache.org/repos/asf/pig/trunk/src/org/apache/pig/newplan/logical/optimizer/SchemaResetter.java: Loading...
  3. http://svn.apache.org/repos/asf/pig/trunk/src/org/apache/pig/newplan/logical/relational/LOCube.java: Loading...
  4. http://svn.apache.org/repos/asf/pig/trunk/src/org/apache/pig/newplan/logical/relational/LogicalRelationalNodesVisitor.java: Loading...
  5. http://svn.apache.org/repos/asf/pig/trunk/src/org/apache/pig/newplan/logical/visitor/ProjectStarExpander.java: Loading...
  6. http://svn.apache.org/repos/asf/pig/trunk/src/org/apache/pig/parser/AliasMasker.g: Loading...
  7. http://svn.apache.org/repos/asf/pig/trunk/src/org/apache/pig/parser/AstPrinter.g: Loading...
  8. http://svn.apache.org/repos/asf/pig/trunk/src/org/apache/pig/parser/AstValidator.g: Loading...
  9. http://svn.apache.org/repos/asf/pig/trunk/src/org/apache/pig/parser/LogicalPlanBuilder.java: Loading...
  10. http://svn.apache.org/repos/asf/pig/trunk/src/org/apache/pig/parser/LogicalPlanGenerator.g: Loading...
  11. http://svn.apache.org/repos/asf/pig/trunk/src/org/apache/pig/parser/QueryLexer.g: Loading...
  12. http://svn.apache.org/repos/asf/pig/trunk/src/org/apache/pig/parser/QueryParser.g: Loading...
  13. http://svn.apache.org/repos/asf/pig/trunk/test/org/apache/pig/parser/TestLexer.pig: Loading...
  14. http://svn.apache.org/repos/asf/pig/trunk/test/org/apache/pig/parser/TestLogicalPlanGenerator.java: Loading...
  15. http://svn.apache.org/repos/asf/pig/trunk/test/org/apache/pig/parser/TestParser.pig: Loading...
  16. http://svn.apache.org/repos/asf/pig/trunk/test/org/apache/pig/parser/TestQueryLexer.java: Loading...
  17. http://svn.apache.org/repos/asf/pig/trunk/test/org/apache/pig/parser/TestQueryParser.java: Loading...
  18. http://svn.apache.org/repos/asf/pig/trunk/test/org/apache/pig/test/TestCubeOperator.java: Loading...