You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pig.apache.org by ch...@apache.org on 2013/11/19 18:13:09 UTC

svn commit: r1543505 - in /pig/branches/tez: src/org/apache/pig/backend/hadoop/executionengine/tez/TezExecutionEngine.java test/org/apache/pig/test/TestCombiner.java

Author: cheolsoo
Date: Tue Nov 19 17:13:08 2013
New Revision: 1543505

URL: http://svn.apache.org/r1543505
Log:
Fix compile error and test failure after PIG-3525

Modified:
    pig/branches/tez/src/org/apache/pig/backend/hadoop/executionengine/tez/TezExecutionEngine.java
    pig/branches/tez/test/org/apache/pig/test/TestCombiner.java

Modified: pig/branches/tez/src/org/apache/pig/backend/hadoop/executionengine/tez/TezExecutionEngine.java
URL: http://svn.apache.org/viewvc/pig/branches/tez/src/org/apache/pig/backend/hadoop/executionengine/tez/TezExecutionEngine.java?rev=1543505&r1=1543504&r2=1543505&view=diff
==============================================================================
--- pig/branches/tez/src/org/apache/pig/backend/hadoop/executionengine/tez/TezExecutionEngine.java (original)
+++ pig/branches/tez/src/org/apache/pig/backend/hadoop/executionengine/tez/TezExecutionEngine.java Tue Nov 19 17:13:08 2013
@@ -22,8 +22,10 @@ import java.util.UUID;
 
 import org.apache.pig.backend.hadoop.executionengine.HExecutionEngine;
 import org.apache.pig.impl.PigContext;
+import org.apache.pig.tools.pigstats.PigStats;
 import org.apache.pig.tools.pigstats.ScriptState;
 import org.apache.pig.tools.pigstats.tez.TezScriptState;
+import org.apache.pig.tools.pigstats.tez.TezStats;
 
 public class TezExecutionEngine extends HExecutionEngine {
 
@@ -32,8 +34,15 @@ public class TezExecutionEngine extends 
         this.launcher = new TezLauncher();
     }
 
+    @Override
     public ScriptState instantiateScriptState() {
-        return new TezScriptState(UUID.randomUUID().toString());
+        TezScriptState ss = new TezScriptState(UUID.randomUUID().toString());
+        ss.setPigContext(pigContext);
+        return ss;
     }
-}
 
+    @Override
+    public PigStats instantiatePigStats() {
+        return new TezStats(pigContext);
+    }
+}

Modified: pig/branches/tez/test/org/apache/pig/test/TestCombiner.java
URL: http://svn.apache.org/viewvc/pig/branches/tez/test/org/apache/pig/test/TestCombiner.java?rev=1543505&r1=1543504&r2=1543505&view=diff
==============================================================================
--- pig/branches/tez/test/org/apache/pig/test/TestCombiner.java (original)
+++ pig/branches/tez/test/org/apache/pig/test/TestCombiner.java Tue Nov 19 17:13:08 2013
@@ -38,6 +38,9 @@ import org.apache.pig.data.DefaultDataBa
 import org.apache.pig.data.Tuple;
 import org.apache.pig.impl.PigContext;
 import org.apache.pig.impl.io.FileLocalizer;
+import org.apache.pig.tools.pigstats.PigStats;
+import org.apache.pig.tools.pigstats.ScriptState;
+import org.junit.After;
 import org.junit.AfterClass;
 import org.junit.Before;
 import org.junit.Test;
@@ -52,6 +55,25 @@ public class TestCombiner {
         cluster.shutDown();
     }
 
+    @Before
+    public void setUp() throws Exception {
+        // cause a re initialization of FileLocalizer's
+        // internal state before each test run
+        // A previous test might have been in a different
+        // mode than the test which is about to run. To
+        // ensure each test runs correctly in it's exectype
+        // mode, let's re initialize.
+        FileLocalizer.setInitialized(false);
+    }
+
+    @After
+    public void tearDown() throws Exception {
+        // Nullify PigStats and ScriptState after every run to ensure new
+        // objects are instantiated for next run.
+        PigStats.start(null);
+        ScriptState.start(null);
+    }
+
     @Test
     public void testSuccessiveUserFuncs1() throws Exception {
         String query = "a = load 'students.txt' as (c1,c2,c3,c4); " +
@@ -89,26 +111,11 @@ public class TestCombiner {
         pigServer.shutdown();
     }
 
-    /*
-     * (non-Javadoc)
-     * @see junit.framework.TestCase#setUp()
-     */
-    @Before
-    public void setUp() throws Exception {
-        // cause a re initialization of FileLocalizer's
-        // internal state before each test run
-        // A previous test might have been in a different
-        // mode than the test which is about to run. To
-        // ensure each test runs correctly in it's exectype
-        // mode, let's re initialize.
-        FileLocalizer.setInitialized(false);
-    }
-
     @Test
     public void testLocal() throws Exception {
         // run the test locally
         FileLocalizer.deleteTempFiles();
-        runTest(new PigServer("local", new Properties()));
+        runTest(new PigServer("local"));
         FileLocalizer.deleteTempFiles();
     }