drill-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j...@apache.org
Subject [10/10] drill git commit: DRILL-1753: Flatten 2 level repeated map
Date Sat, 29 Nov 2014 19:16:22 GMT
DRILL-1753: Flatten 2 level repeated map


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

Branch: refs/heads/master
Commit: 86a775f1d132d893e8b84081c5889d990f195334
Parents: 71ad125
Author: Jason Altekruse <altekrusejason@gmail.com>
Authored: Thu Nov 20 17:22:40 2014 -0800
Committer: Jason Altekruse <altekrusejason@gmail.com>
Committed: Fri Nov 28 22:28:25 2014 -0800

----------------------------------------------------------------------
 .../drill/exec/physical/impl/flatten/FlattenRecordBatch.java   | 6 ++----
 .../apache/drill/exec/vector/complex/RepeatedMapVector.java    | 3 +--
 .../apache/drill/exec/physical/impl/flatten/TestFlatten.java   | 5 +++++
 .../src/test/resources/store/json/2_level_repeated_map.json    | 1 +
 4 files changed, 9 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/drill/blob/86a775f1/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/flatten/FlattenRecordBatch.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/flatten/FlattenRecordBatch.java
b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/flatten/FlattenRecordBatch.java
index 9522e26..f606090 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/flatten/FlattenRecordBatch.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/flatten/FlattenRecordBatch.java
@@ -261,8 +261,7 @@ public class FlattenRecordBatch extends AbstractSingleRecordBatch<FlattenPOP>
{
           if (vw.getValueVector() instanceof MapVector) {
             // fast schema upstream did not report a repeated type
             // assume it will be repeated in the actual results and it will fail in execution
if it is not
-            ValueVector vector = container.addOrGet(vw.getField());
-            container.add(vector);
+            container.addOrGet(vw.getField());
           } else {
             TransferPair pair = getFlattenFieldTransferPair();
             if (pair == null) {
@@ -271,8 +270,7 @@ public class FlattenRecordBatch extends AbstractSingleRecordBatch<FlattenPOP>
{
             container.add(pair.getTo());
           }
         } else {
-          ValueVector vector = container.addOrGet(vw.getField());
-          container.add(vector);
+          container.addOrGet(vw.getField());
         }
       }
       fastSchemaCalled = true;

http://git-wip-us.apache.org/repos/asf/drill/blob/86a775f1/exec/java-exec/src/main/java/org/apache/drill/exec/vector/complex/RepeatedMapVector.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/vector/complex/RepeatedMapVector.java
b/exec/java-exec/src/main/java/org/apache/drill/exec/vector/complex/RepeatedMapVector.java
index 01ca841..e140c8b 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/vector/complex/RepeatedMapVector.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/vector/complex/RepeatedMapVector.java
@@ -69,7 +69,6 @@ public class RepeatedMapVector extends AbstractContainerVector implements
Repeat
   private final BufferAllocator allocator;
   private final MaterializedField field;
   private int lastPopulatedValueIndex = -1;
-  private int lastSet = -1;
   private CallBack callBack;
 
   public RepeatedMapVector(MaterializedField field, BufferAllocator allocator, CallBack callBack){
@@ -398,7 +397,7 @@ public class RepeatedMapVector extends AbstractContainerVector implements
Repeat
       }
 
       m.setValueCount(groups + 1);
-      to.lastSet = groups;
+      to.lastPopulatedValueIndex = groups - 1;
 
       for (TransferPair p : pairs) {
         p.splitAndTransfer(startPos, valuesToCopy);

http://git-wip-us.apache.org/repos/asf/drill/blob/86a775f1/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/flatten/TestFlatten.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/flatten/TestFlatten.java
b/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/flatten/TestFlatten.java
index 23cf6cd..dcdbc8d 100644
--- a/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/flatten/TestFlatten.java
+++ b/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/flatten/TestFlatten.java
@@ -192,4 +192,9 @@ public class TestFlatten extends BaseTestQuery {
     test("select a, flatten(r_map_1), flatten(r_map_2) from cp.`/store/json/complex_repeated_map.json`");
   }
 
+  @Test
+  public void testFlatten2_levelRepeatedMap() throws Exception {
+    test("select flatten(rm) from cp.`/store/json/2_level_repeated_map.json`");
+  }
+
 }

http://git-wip-us.apache.org/repos/asf/drill/blob/86a775f1/exec/java-exec/src/test/resources/store/json/2_level_repeated_map.json
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/test/resources/store/json/2_level_repeated_map.json b/exec/java-exec/src/test/resources/store/json/2_level_repeated_map.json
new file mode 100644
index 0000000..0c304f0
--- /dev/null
+++ b/exec/java-exec/src/test/resources/store/json/2_level_repeated_map.json
@@ -0,0 +1 @@
+{ "rm": [ {"map": [{ "a": "foo"}]}]}
\ No newline at end of file


Mime
View raw message