drill-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From par...@apache.org
Subject drill git commit: DRILL-1875: getTransferClone should ignore given wrappers
Date Wed, 04 Mar 2015 01:39:52 GMT
Repository: drill
Updated Branches:
  refs/heads/master a84f7b9e8 -> 767a97648


DRILL-1875: getTransferClone should ignore given wrappers


Project: http://git-wip-us.apache.org/repos/asf/drill/repo
Commit: http://git-wip-us.apache.org/repos/asf/drill/commit/767a9764
Tree: http://git-wip-us.apache.org/repos/asf/drill/tree/767a9764
Diff: http://git-wip-us.apache.org/repos/asf/drill/diff/767a9764

Branch: refs/heads/master
Commit: 767a976489ea492e7c5fae6ab7d6f0af729363b6
Parents: a84f7b9
Author: Hanifi Gunes <hgunes@maprtech.com>
Authored: Mon Mar 2 13:38:17 2015 -0800
Committer: Parth Chandra <pchandra@maprtech.com>
Committed: Tue Mar 3 16:23:25 2015 -0800

----------------------------------------------------------------------
 .../drill/exec/record/VectorContainer.java      | 20 +++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/drill/blob/767a9764/exec/java-exec/src/main/java/org/apache/drill/exec/record/VectorContainer.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/record/VectorContainer.java
b/exec/java-exec/src/main/java/org/apache/drill/exec/record/VectorContainer.java
index 7b772cc..baf74b1 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/record/VectorContainer.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/record/VectorContainer.java
@@ -23,7 +23,9 @@ import java.util.Collections;
 import java.util.Comparator;
 import java.util.Iterator;
 import java.util.List;
+import java.util.Set;
 
+import com.google.common.collect.Sets;
 import org.apache.drill.common.expression.SchemaPath;
 import org.apache.drill.common.types.TypeProtos.MajorType;
 import org.apache.drill.exec.expr.TypeHelper;
@@ -116,16 +118,16 @@ public class VectorContainer implements Iterable<VectorWrapper<?>>,
VectorAccess
   }
 
   public static VectorContainer getTransferClone(VectorAccessible incoming, VectorWrapper[]
ignoreWrappers) {
-    VectorContainer vc = new VectorContainer();
-    for (VectorWrapper<?> w : incoming) {
-      if(ignoreWrappers != null) {
-        for(VectorWrapper wrapper : ignoreWrappers) {
-          if (w == wrapper) {
-            continue;
-          }
-        }
-      }
+    Iterable<VectorWrapper<?>> wrappers = incoming;
+    if (ignoreWrappers != null) {
+      final List<VectorWrapper> ignored = Lists.newArrayList(ignoreWrappers);
+      final Set<VectorWrapper<?>> resultant = Sets.newLinkedHashSet(incoming);
+      resultant.removeAll(ignored);
+      wrappers = resultant;
+    }
 
+    final VectorContainer vc = new VectorContainer();
+    for (VectorWrapper<?> w : wrappers) {
       vc.cloneAndTransfer(w);
     }
 


Mime
View raw message