tajo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jihoon...@apache.org
Subject git commit: TAJO-177: Call by reference bug in MergeJoinExec. (jihoon)
Date Wed, 11 Sep 2013 09:05:52 GMT
Updated Branches:
  refs/heads/master 473347e33 -> 5fb493126


TAJO-177: Call by reference bug in MergeJoinExec. (jihoon)


Project: http://git-wip-us.apache.org/repos/asf/incubator-tajo/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-tajo/commit/5fb49312
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tajo/tree/5fb49312
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tajo/diff/5fb49312

Branch: refs/heads/master
Commit: 5fb4931264479c8d81ace16948fa8f956239c084
Parents: 473347e
Author: Jihoon Son <jihoonson@apache.org>
Authored: Wed Sep 11 18:05:20 2013 +0900
Committer: Jihoon Son <jihoonson@apache.org>
Committed: Wed Sep 11 18:05:20 2013 +0900

----------------------------------------------------------------------
 CHANGES.txt                                     |  2 +
 .../java/org/apache/tajo/storage/Tuple.java     |  4 +-
 .../engine/planner/physical/MergeJoinExec.java  | 46 +++++++++++---------
 .../org/apache/tajo/storage/FrameTuple.java     |  5 +++
 .../java/org/apache/tajo/storage/Tuple.java     |  4 +-
 .../java/org/apache/tajo/storage/VTuple.java    |  5 +++
 6 files changed, 43 insertions(+), 23 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/5fb49312/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 78238b8..c1fa4d6 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -133,6 +133,8 @@ Release 0.2.0 - unreleased
 
   BUG FIXES
 
+    TAJO-177: Call by reference bug in MergeJoinExec. (jihoon)
+
     TAJO-171: BitArray always returned false. (jinho)
 
     TAJO-172: TajoWorker allocate wrong container slots.(jinho)

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/5fb49312/tajo-common/src/main/java/org/apache/tajo/storage/Tuple.java
----------------------------------------------------------------------
diff --git a/tajo-common/src/main/java/org/apache/tajo/storage/Tuple.java b/tajo-common/src/main/java/org/apache/tajo/storage/Tuple.java
index e56a7a4..711666f 100644
--- a/tajo-common/src/main/java/org/apache/tajo/storage/Tuple.java
+++ b/tajo-common/src/main/java/org/apache/tajo/storage/Tuple.java
@@ -22,7 +22,7 @@ import org.apache.tajo.datum.*;
 
 import java.net.InetAddress;
 
-public interface Tuple {
+public interface Tuple extends Cloneable {
 
   public int size();
 
@@ -75,4 +75,6 @@ public interface Tuple {
   public TextDatum getString(int fieldId);
 
   public TextDatum getText(int fieldId);
+
+  public Tuple clone() throws CloneNotSupportedException;
 }

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/5fb49312/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/physical/MergeJoinExec.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/physical/MergeJoinExec.java
b/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/physical/MergeJoinExec.java
index 1820c32..4970106 100644
--- a/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/physical/MergeJoinExec.java
+++ b/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/physical/MergeJoinExec.java
@@ -131,28 +131,32 @@ public class MergeJoinExec extends BinaryPhysicalExec {
           }
         }
 
-        previous = outerTuple;
-        do {
-          outerTupleSlots.add(outerTuple);
-          outerTuple = leftChild.next();
-          if (outerTuple == null) {
-            end = true;
-            break;
-          }
-        } while (tupleComparator[0].compare(previous, outerTuple) == 0);
-        outerIterator = outerTupleSlots.iterator();
-        outerNext = outerIterator.next();
+        try {
+          previous = outerTuple.clone();
+          do {
+            outerTupleSlots.add(outerTuple.clone());
+            outerTuple = leftChild.next();
+            if (outerTuple == null) {
+              end = true;
+              break;
+            }
+          } while (tupleComparator[0].compare(previous, outerTuple) == 0);
+          outerIterator = outerTupleSlots.iterator();
+          outerNext = outerIterator.next();
+
+          previous = innerTuple.clone();
+          do {
+            innerTupleSlots.add(innerTuple.clone());
+            innerTuple = rightChild.next();
+            if (innerTuple == null) {
+              end = true;
+              break;
+            }
+          } while (tupleComparator[1].compare(previous, innerTuple) == 0);
+          innerIterator = innerTupleSlots.iterator();
+        } catch (CloneNotSupportedException e) {
 
-        previous = innerTuple;
-        do {
-          innerTupleSlots.add(innerTuple);
-          innerTuple = rightChild.next();
-          if (innerTuple == null) {
-            end = true;
-            break;
-          }
-        } while (tupleComparator[1].compare(previous, innerTuple) == 0);
-        innerIterator = innerTupleSlots.iterator();
+        }
       }
 
       if(!innerIterator.hasNext()){

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/5fb49312/tajo-core/tajo-core-storage/src/main/java/org/apache/tajo/storage/FrameTuple.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-storage/src/main/java/org/apache/tajo/storage/FrameTuple.java
b/tajo-core/tajo-core-storage/src/main/java/org/apache/tajo/storage/FrameTuple.java
index c0c8536..8979b4b 100644
--- a/tajo-core/tajo-core-storage/src/main/java/org/apache/tajo/storage/FrameTuple.java
+++ b/tajo-core/tajo-core-storage/src/main/java/org/apache/tajo/storage/FrameTuple.java
@@ -197,6 +197,11 @@ public class FrameTuple implements Tuple {
     return (TextDatum) get(fieldId);
   }
 
+  @Override
+  public Tuple clone() throws CloneNotSupportedException {
+    return new FrameTuple(this.left.clone(), this.right.clone());
+  }
+
   public String toString() {
     boolean first = true;
     StringBuilder str = new StringBuilder();

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/5fb49312/tajo-core/tajo-core-storage/src/main/java/org/apache/tajo/storage/Tuple.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-storage/src/main/java/org/apache/tajo/storage/Tuple.java
b/tajo-core/tajo-core-storage/src/main/java/org/apache/tajo/storage/Tuple.java
index dd86a12..6d0e833 100644
--- a/tajo-core/tajo-core-storage/src/main/java/org/apache/tajo/storage/Tuple.java
+++ b/tajo-core/tajo-core-storage/src/main/java/org/apache/tajo/storage/Tuple.java
@@ -22,7 +22,7 @@ import org.apache.tajo.datum.*;
 
 import java.net.InetAddress;
 
-public interface Tuple {
+public interface Tuple extends Cloneable {
   
 	public int size();
 	
@@ -75,4 +75,6 @@ public interface Tuple {
 	public TextDatum getString(int fieldId);
 
   public TextDatum getText(int fieldId);
+
+  public Tuple clone() throws CloneNotSupportedException;
 }

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/5fb49312/tajo-core/tajo-core-storage/src/main/java/org/apache/tajo/storage/VTuple.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-storage/src/main/java/org/apache/tajo/storage/VTuple.java
b/tajo-core/tajo-core-storage/src/main/java/org/apache/tajo/storage/VTuple.java
index 31a3f73..eb69bdb 100644
--- a/tajo-core/tajo-core-storage/src/main/java/org/apache/tajo/storage/VTuple.java
+++ b/tajo-core/tajo-core-storage/src/main/java/org/apache/tajo/storage/VTuple.java
@@ -167,6 +167,11 @@ public class VTuple implements Tuple {
     return (TextDatum) values[fieldId];
   }
 
+  @Override
+  public Tuple clone() throws CloneNotSupportedException {
+    return new VTuple(this);
+  }
+
   public String toString() {
 		boolean first = true;
 		StringBuilder str = new StringBuilder();


Mime
View raw message