Author: gates
Date: Wed May 21 12:45:10 2008
New Revision: 658827

URL: http://svn.apache.org/viewvc?rev=658827&view=rev
Log:
Connected in logical to physical translator.


Modified:
    
incubator/pig/branches/types/src/org/apache/pig/backend/hadoop/executionengine/HExecutionEngine.java
    
incubator/pig/branches/types/src/org/apache/pig/backend/local/executionengine/LocalExecutionEngine.java

Modified: 
incubator/pig/branches/types/src/org/apache/pig/backend/hadoop/executionengine/HExecutionEngine.java
URL: 
http://svn.apache.org/viewvc/incubator/pig/branches/types/src/org/apache/pig/backend/hadoop/executionengine/HExecutionEngine.java?rev=658827&r1=658826&r2=658827&view=diff
==============================================================================
--- 
incubator/pig/branches/types/src/org/apache/pig/backend/hadoop/executionengine/HExecutionEngine.java
 (original)
+++ 
incubator/pig/branches/types/src/org/apache/pig/backend/hadoop/executionengine/HExecutionEngine.java
 Wed May 21 12:45:10 2008
@@ -51,12 +51,14 @@
 import org.apache.pig.impl.io.FileLocalizer;
 import org.apache.pig.impl.io.FileSpec;
 import org.apache.pig.impl.logicalLayer.LogicalPlan;
-import org.apache.pig.impl.logicalLayer.OperatorKey;
+import org.apache.pig.impl.logicalLayer.LogToPhyTranslationVisitor;
 import org.apache.pig.impl.logicalLayer.parser.NodeIdGenerator;
+import org.apache.pig.impl.logicalLayer.OperatorKey;
 import org.apache.pig.impl.mapReduceLayer.MapReduceLauncher;
 import org.apache.pig.impl.physicalLayer.topLevelOperators.PhysicalOperator;
 import org.apache.pig.impl.physicalLayer.topLevelOperators.POStore;
 import org.apache.pig.impl.physicalLayer.plans.PhysicalPlan;
+import org.apache.pig.impl.plan.VisitorException;
 import org.apache.pig.shock.SSHSocketImplFactory;
 
 
@@ -218,13 +220,24 @@
     }
 
     public PhysicalPlan compile(LogicalPlan[] plans,
-                                Properties properties)
-            throws ExecException {
-        // TODO FIX Plug in Shubham's translator here.
-        /*if (plans == null) {
+                                Properties properties) throws ExecException {
+        if (plans == null) {
             throw new ExecException("No Plans to compile");
         }
 
+        // TODO FIX Need to stich togther the plans.
+        try {
+            LogicalPlan lp = null;
+            LogToPhyTranslationVisitor translator = 
+                new LogToPhyTranslationVisitor(lp);
+            translator.setPigContext(pigContext);
+            translator.visit();
+            return translator.getPhysicalPlan();
+        } catch (VisitorException ve) {
+            throw new ExecException(ve);
+        }
+
+        /*
         OperatorKey physicalKey = null;
         for (int i = 0; i < plans.length; ++i) {
             LogicalPlan curPlan = null;
@@ -252,7 +265,6 @@
         }
         
         return new MapRedPhysicalPlan(physicalKey, physicalOpTable);*/
-        throw new ExecException("Unsupported Operation");
     }
 
     public ExecJob execute(PhysicalPlan plan,

Modified: 
incubator/pig/branches/types/src/org/apache/pig/backend/local/executionengine/LocalExecutionEngine.java
URL: 
http://svn.apache.org/viewvc/incubator/pig/branches/types/src/org/apache/pig/backend/local/executionengine/LocalExecutionEngine.java?rev=658827&r1=658826&r2=658827&view=diff
==============================================================================
--- 
incubator/pig/branches/types/src/org/apache/pig/backend/local/executionengine/LocalExecutionEngine.java
 (original)
+++ 
incubator/pig/branches/types/src/org/apache/pig/backend/local/executionengine/LocalExecutionEngine.java
 Wed May 21 12:45:10 2008
@@ -42,13 +42,16 @@
 import org.apache.pig.builtin.BinStorage;
 import org.apache.pig.impl.io.FileLocalizer;
 import org.apache.pig.impl.io.FileSpec;
-import org.apache.pig.impl.logicalLayer.*;
+import org.apache.pig.impl.logicalLayer.LogicalOperator;
 import org.apache.pig.impl.logicalLayer.LogicalPlan;
+import org.apache.pig.impl.logicalLayer.LogToPhyTranslationVisitor;
+import org.apache.pig.impl.logicalLayer.OperatorKey;
 import org.apache.pig.impl.logicalLayer.parser.NodeIdGenerator;
 import org.apache.pig.impl.mapReduceLayer.LocalLauncher;
 import org.apache.pig.impl.physicalLayer.plans.PhysicalPlan;
 import org.apache.pig.impl.physicalLayer.topLevelOperators.PhysicalOperator;
 import org.apache.pig.impl.physicalLayer.topLevelOperators.POStore;
+import org.apache.pig.impl.plan.VisitorException;
 import java.util.Iterator;
 
 
@@ -114,12 +117,23 @@
 
     public PhysicalPlan compile(LogicalPlan[] plans,
                                 Properties properties) throws ExecException {
-        // TODO FIX Plug in logical to physical translator
-        /*
         if (plans == null) {
             throw new ExecException("No Plans to compile");
         }
 
+        // TODO FIX Need to stich togther the plans.
+        try {
+            LogicalPlan lp = null;
+            LogToPhyTranslationVisitor translator = 
+                new LogToPhyTranslationVisitor(lp);
+            translator.setPigContext(pigContext);
+            translator.visit();
+            return translator.getPhysicalPlan();
+        } catch (VisitorException ve) {
+            throw new ExecException(ve);
+        }
+
+        /*
         OperatorKey physicalKey = null;
         for (int i = 0; i < plans.length; ++i) {
             LogicalPlan curPlan = null;
@@ -141,7 +155,6 @@
         
         return new LocalPhysicalPlan(physicalKey, physicalOpTable);
         */
-        return null;
     }
 
     public ExecJob execute(PhysicalPlan plan,


Reply via email to