Author: pradeepkth
Date: Tue Apr 7 19:23:52 2009
New Revision: 762916
URL: http://svn.apache.org/viewvc?rev=762916&view=rev
Log:
PIG-627: multiquery support incremental patch (hagleitn via pradeepkth)
Added:
hadoop/pig/branches/multiquery/src/org/apache/pig/backend/hadoop/executionengine/mapReduceLayer/PhyPlanSetter.java
Added:
hadoop/pig/branches/multiquery/src/org/apache/pig/backend/hadoop/executionengine/mapReduceLayer/PhyPlanSetter.java
URL:
http://svn.apache.org/viewvc/hadoop/pig/branches/multiquery/src/org/apache/pig/backend/hadoop/executionengine/mapReduceLayer/PhyPlanSetter.java?rev=762916&view=auto
==============================================================================
---
hadoop/pig/branches/multiquery/src/org/apache/pig/backend/hadoop/executionengine/mapReduceLayer/PhyPlanSetter.java
(added)
+++
hadoop/pig/branches/multiquery/src/org/apache/pig/backend/hadoop/executionengine/mapReduceLayer/PhyPlanSetter.java
Tue Apr 7 19:23:52 2009
@@ -0,0 +1,285 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.pig.backend.hadoop.executionengine.mapReduceLayer;
+
+import
org.apache.pig.backend.hadoop.executionengine.physicalLayer.PhysicalOperator;
+import
org.apache.pig.backend.hadoop.executionengine.physicalLayer.expressionOperators.*;
+import
org.apache.pig.backend.hadoop.executionengine.physicalLayer.relationalOperators.*;
+import
org.apache.pig.backend.hadoop.executionengine.physicalLayer.relationalOperators.POSplit;
+import
org.apache.pig.backend.local.executionengine.physicalLayer.relationalOperators.*;
+import
org.apache.pig.backend.hadoop.executionengine.physicalLayer.plans.PhyPlanVisitor;
+import
org.apache.pig.backend.hadoop.executionengine.physicalLayer.plans.PhysicalPlan;
+import org.apache.pig.impl.plan.DependencyOrderWalker;
+import org.apache.pig.impl.plan.VisitorException;
+
+/**
+ * Sets the parent plan for all Physical Operators. Note: parentPlan
+ * is a bit of a misnomer. We actually want all the operators to point
+ * to the same plan - not necessarily the one they're a member of.
+ */
+public class PhyPlanSetter extends PhyPlanVisitor {
+ PhysicalPlan parent;
+
+ public PhyPlanSetter(PhysicalPlan plan) {
+ super(plan, new DependencyOrderWalker<PhysicalOperator,
PhysicalPlan>(plan));
+ parent = plan;
+ }
+
+ @Override
+ public void visitLoad(POLoad ld) throws VisitorException{
+ ld.setParentPlan(parent);
+ }
+
+ @Override
+ public void visitStore(POStore st) throws VisitorException{
+ st.setParentPlan(parent);
+ }
+
+ @Override
+ public void visitFilter(POFilter fl) throws VisitorException{
+ super.visitFilter(fl);
+ fl.setParentPlan(parent);
+ }
+
+ @Override
+ public void visitLocalRearrange(POLocalRearrange lr) throws
VisitorException{
+ super.visitLocalRearrange(lr);
+ lr.setParentPlan(parent);
+ }
+
+ @Override
+ public void visitGlobalRearrange(POGlobalRearrange gr) throws
VisitorException{
+ gr.setParentPlan(parent);
+ }
+
+ @Override
+ public void visitPackage(POPackage pkg) throws VisitorException{
+ pkg.setParentPlan(parent);
+ }
+
+ @Override
+ public void visitCombinerPackage(POCombinerPackage pkg) throws
VisitorException{
+ pkg.setParentPlan(parent);
+ }
+
+ @Override
+ public void visitPOForEach(POForEach nfe) throws VisitorException {
+ super.visitPOForEach(nfe);
+ nfe.setParentPlan(parent);
+ }
+
+ @Override
+ public void visitUnion(POUnion un) throws VisitorException{
+ un.setParentPlan(parent);
+ }
+
+ @Override
+ public void visitSplit(POSplit spl) throws VisitorException{
+ super.visitSplit(spl);
+ spl.setParentPlan(parent);
+ }
+
+ @Override
+ public void visitDistinct(PODistinct distinct) throws VisitorException {
+ distinct.setParentPlan(parent);
+ }
+
+ @Override
+ public void visitRead(PORead read) throws VisitorException {
+ read.setParentPlan(parent);
+ }
+
+ @Override
+ public void visitSort(POSort sort) throws VisitorException {
+ super.visitSort(sort);
+ sort.setParentPlan(parent);
+ }
+
+ @Override
+ public void visitConstant(ConstantExpression cnst) throws VisitorException{
+ cnst.setParentPlan(parent);
+ }
+
+ @Override
+ public void visitProject(POProject proj) throws VisitorException{
+ proj.setParentPlan(parent);
+ }
+
+ @Override
+ public void visitGreaterThan(GreaterThanExpr grt) throws VisitorException{
+ grt.setParentPlan(parent);
+ }
+
+ @Override
+ public void visitLessThan(LessThanExpr lt) throws VisitorException{
+ lt.setParentPlan(parent);
+ }
+
+ @Override
+ public void visitGTOrEqual(GTOrEqualToExpr gte) throws VisitorException{
+ gte.setParentPlan(parent);
+ }
+
+ @Override
+ public void visitLTOrEqual(LTOrEqualToExpr lte) throws VisitorException{
+ lte.setParentPlan(parent);
+ }
+
+ @Override
+ public void visitEqualTo(EqualToExpr eq) throws VisitorException{
+ eq.setParentPlan(parent);
+ }
+
+ @Override
+ public void visitNotEqualTo(NotEqualToExpr eq) throws VisitorException{
+ eq.setParentPlan(parent);
+ }
+
+ @Override
+ public void visitRegexp(PORegexp re) throws VisitorException{
+ re.setParentPlan(parent);
+ }
+
+ @Override
+ public void visitIsNull(POIsNull isNull) throws VisitorException {
+ isNull.setParentPlan(parent);
+ }
+
+ @Override
+ public void visitAdd(Add add) throws VisitorException{
+ add.setParentPlan(parent);
+ }
+
+ @Override
+ public void visitSubtract(Subtract sub) throws VisitorException {
+ sub.setParentPlan(parent);
+ }
+
+ @Override
+ public void visitMultiply(Multiply mul) throws VisitorException {
+ mul.setParentPlan(parent);
+ }
+
+ @Override
+ public void visitDivide(Divide dv) throws VisitorException {
+ dv.setParentPlan(parent);
+ }
+
+ @Override
+ public void visitMod(Mod mod) throws VisitorException {
+ mod.setParentPlan(parent);
+ }
+
+ @Override
+ public void visitAnd(POAnd and) throws VisitorException {
+ and.setParentPlan(parent);
+ }
+
+ @Override
+ public void visitOr(POOr or) throws VisitorException {
+ or.setParentPlan(parent);
+ }
+
+ @Override
+ public void visitNot(PONot not) throws VisitorException {
+ not.setParentPlan(parent);
+ }
+
+ @Override
+ public void visitBinCond(POBinCond binCond) {
+ binCond.setParentPlan(parent);
+ }
+
+ @Override
+ public void visitNegative(PONegative negative) {
+ negative.setParentPlan(parent);
+ }
+
+ @Override
+ public void visitUserFunc(POUserFunc userFunc) throws VisitorException {
+ userFunc.setParentPlan(parent);
+ }
+
+ @Override
+ public void visitComparisonFunc(POUserComparisonFunc compFunc) throws
VisitorException {
+ compFunc.setParentPlan(parent);
+ }
+
+ @Override
+ public void visitMapLookUp(POMapLookUp mapLookUp) {
+ mapLookUp.setParentPlan(parent);
+ }
+
+ @Override
+ public void visitJoinPackage(POJoinPackage joinPackage) throws
VisitorException{
+ joinPackage.setParentPlan(parent);
+ }
+
+ @Override
+ public void visitCast(POCast cast) {
+ cast.setParentPlan(parent);
+ }
+
+ @Override
+ public void visitLimit(POLimit lim) throws VisitorException{
+ lim.setParentPlan(parent);
+ }
+
+ @Override
+ public void visitFRJoin(POFRJoin join) throws VisitorException {
+ join.setParentPlan(parent);
+ }
+
+ @Override
+ public void visitStream(POStream stream) throws VisitorException {
+ stream.setParentPlan(parent);
+ }
+
+ @Override
+ public void visitCogroup(POCogroup cogroup) {
+ cogroup.setParentPlan(parent);
+ }
+
+ @Override
+ public void
visitSplit(org.apache.pig.backend.local.executionengine.physicalLayer.relationalOperators.POSplit
split) {
+ split.setParentPlan(parent);
+ }
+
+ @Override
+ public void visitLocalRearrangeForIllustrate(
+ POLocalRearrangeForIllustrate lrfi) throws VisitorException {
+ super.visitLocalRearrangeForIllustrate(lrfi);
+ lrfi.setParentPlan(parent);
+ }
+
+ @Override
+ public void visitPOOptimizedForEach(POOptimizedForEach optimizedForEach) {
+ optimizedForEach.setParentPlan(parent);
+ }
+
+ @Override
+ public void visitPreCombinerLocalRearrange(
+ POPreCombinerLocalRearrange preCombinerLocalRearrange) {
+ preCombinerLocalRearrange.setParentPlan(parent);
+ }
+
+ @Override
+ public void visitCross(POCross cross) {
+ cross.setParentPlan(parent);
+ }
+}