pig-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From roh...@apache.org
Subject svn commit: r1779958 - in /pig/branches/branch-0.16: src/org/apache/pig/backend/hadoop/executionengine/tez/plan/operator/POSimpleTezLoad.java test/org/apache/pig/test/TestLocal.java
Date Mon, 23 Jan 2017 17:30:47 GMT
Author: rohini
Date: Mon Jan 23 17:30:46 2017
New Revision: 1779958

URL: http://svn.apache.org/viewvc?rev=1779958&view=rev
Log:
PIG-5108 Additional patch to issue for all tuple types (rohini)

Modified:
    pig/branches/branch-0.16/src/org/apache/pig/backend/hadoop/executionengine/tez/plan/operator/POSimpleTezLoad.java
    pig/branches/branch-0.16/test/org/apache/pig/test/TestLocal.java

Modified: pig/branches/branch-0.16/src/org/apache/pig/backend/hadoop/executionengine/tez/plan/operator/POSimpleTezLoad.java
URL: http://svn.apache.org/viewvc/pig/branches/branch-0.16/src/org/apache/pig/backend/hadoop/executionengine/tez/plan/operator/POSimpleTezLoad.java?rev=1779958&r1=1779957&r2=1779958&view=diff
==============================================================================
--- pig/branches/branch-0.16/src/org/apache/pig/backend/hadoop/executionengine/tez/plan/operator/POSimpleTezLoad.java
(original)
+++ pig/branches/branch-0.16/src/org/apache/pig/backend/hadoop/executionengine/tez/plan/operator/POSimpleTezLoad.java
Mon Jan 23 17:30:46 2017
@@ -60,6 +60,8 @@ public class POSimpleTezLoad extends POL
     private transient Configuration conf;
     private transient boolean finished = false;
     private transient TezCounter inputRecordCounter;
+    private transient boolean initialized;
+    private transient boolean noTupleCopy;
 
     public POSimpleTezLoad(OperatorKey k, LoadFunc loader) {
         super(k, loader);
@@ -149,7 +151,13 @@ public class POSimpleTezLoad extends POL
             } else {
                 Result res = new Result();
                 Tuple next = (Tuple) reader.getCurrentValue();
-                res.result = next;
+                if (!initialized) {
+                    noTupleCopy = mTupleFactory.newTuple(1).getClass().isInstance(next);
+                    initialized = true;
+                }
+                // Some Loaders return implementations of DefaultTuple instead of BinSedesTuple
+                // In that case copy to BinSedesTuple
+                res.result = noTupleCopy ? next : mTupleFactory.newTupleNoCopy(next.getAll());
                 res.returnStatus = POStatus.STATUS_OK;
                 if (inputRecordCounter != null) {
                     inputRecordCounter.increment(1);

Modified: pig/branches/branch-0.16/test/org/apache/pig/test/TestLocal.java
URL: http://svn.apache.org/viewvc/pig/branches/branch-0.16/test/org/apache/pig/test/TestLocal.java?rev=1779958&r1=1779957&r2=1779958&view=diff
==============================================================================
--- pig/branches/branch-0.16/test/org/apache/pig/test/TestLocal.java (original)
+++ pig/branches/branch-0.16/test/org/apache/pig/test/TestLocal.java Mon Jan 23 17:30:46 2017
@@ -39,6 +39,7 @@ import org.apache.pig.builtin.PigStorage
 import org.apache.pig.data.BagFactory;
 import org.apache.pig.data.DataBag;
 import org.apache.pig.data.DataType;
+import org.apache.pig.data.DefaultTuple;
 import org.apache.pig.data.Tuple;
 import org.apache.pig.data.TupleFactory;
 import org.apache.pig.impl.io.FileLocalizer;
@@ -166,7 +167,8 @@ public class TestLocal {
         public Tuple getNext() throws IOException {
             if (count < COUNT) {
 
-                   Tuple t = TupleFactory.getInstance().newTuple(Integer.toString(count++));
+                   Tuple t = new DefaultTuple();
+                   t.append(Integer.toString(count++));
                    return t;
 
             }



Mime
View raw message