Author: daijy
Date: Tue Jan  6 23:52:09 2015
New Revision: 1649977

URL: http://svn.apache.org/r1649977
Log:
PIG-4368: Port local mode tests to Tez - TestLoadStoreFuncLifeCycle

Modified:
    pig/trunk/CHANGES.txt
    pig/trunk/test/org/apache/pig/TestLoadStoreFuncLifeCycle.java

Modified: pig/trunk/CHANGES.txt
URL: 
http://svn.apache.org/viewvc/pig/trunk/CHANGES.txt?rev=1649977&r1=1649976&r2=1649977&view=diff
==============================================================================
--- pig/trunk/CHANGES.txt (original)
+++ pig/trunk/CHANGES.txt Tue Jan  6 23:52:09 2015
@@ -32,6 +32,8 @@ PIG-4333: Split BigData tests into multi
  
 BUG FIXES
 
+PIG-4368: Port local mode tests to Tez - TestLoadStoreFuncLifeCycle (daijy)
+
 PIG-4367: Port local mode tests to Tez - TestMultiQueryBasic (daijy)
 
 PIG-4339: e2e test framework assumes default exectype as mapred (rohini)

Modified: pig/trunk/test/org/apache/pig/TestLoadStoreFuncLifeCycle.java
URL: 
http://svn.apache.org/viewvc/pig/trunk/test/org/apache/pig/TestLoadStoreFuncLifeCycle.java?rev=1649977&r1=1649976&r2=1649977&view=diff
==============================================================================
--- pig/trunk/test/org/apache/pig/TestLoadStoreFuncLifeCycle.java (original)
+++ pig/trunk/test/org/apache/pig/TestLoadStoreFuncLifeCycle.java Tue Jan  6 
23:52:09 2015
@@ -327,7 +327,7 @@ public class TestLoadStoreFuncLifeCycle
 
     @Test
     public void testLoadStoreFunc() throws Exception {
-        PigServer pigServer = new PigServer(ExecType.LOCAL);
+        PigServer pigServer = new PigServer(Util.getLocalTestMode());
         Data data = Storage.resetData(pigServer.getPigContext());
         data.set("foo",
                 tuple("a"),
@@ -346,13 +346,22 @@ public class TestLoadStoreFuncLifeCycle
         assertEquals("c", out.get(2).get(0));
 
         assertTrue("loader instanciation count increasing: " + Loader.count, 
Loader.count <= 3);
-        // LocalJobRunner gets the outputcommitter to call setupJob in Hadoop
-        // 2.0.x which was not done in Hadoop 1.0.x. (MAPREDUCE-3563) As a
-        // result, the number of StoreFunc instances is greater by 1 in
-        // Hadoop-2.0.x.
-        assertTrue("storer instanciation count increasing: " + Storer.count,
-                Storer.count <= (org.apache.pig.impl.util.Utils.isHadoop2() ? 
5 : 4));
 
+        // In Tez, Pig instantiate StoreFunc one more time to collect 
byteswritten for output file.
+        // This step is wrong in MR local mode, since it rely on hdfs counter 
to get it, if the output
+        // file is local, byteswritten is 0
+        if (Util.getLocalTestMode().toString().startsWith("TEZ")) {
+            assertTrue("storer instanciation count increasing: " + 
Storer.count,
+                    Storer.count == 6);
+            return;
+        } else {
+            // LocalJobRunner gets the outputcommitter to call setupJob in 
Hadoop
+            // 2.0.x which was not done in Hadoop 1.0.x. (MAPREDUCE-3563) As a
+            // result, the number of StoreFunc instances is greater by 1 in
+            // Hadoop-2.0.x.
+            assertTrue("storer instanciation count increasing: " + 
Storer.count,
+                    Storer.count <= 
(org.apache.pig.impl.util.Utils.isHadoop2() ? 5 : 4));
+        }
     }
 
     /**


Reply via email to