You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@drill.apache.org by js...@apache.org on 2014/11/29 20:16:20 UTC
[08/10] drill git commit: Fix for flatten receiving a non-repeated
type during fast schema step.
Fix for flatten receiving a non-repeated type during fast schema step.
Project: http://git-wip-us.apache.org/repos/asf/drill/repo
Commit: http://git-wip-us.apache.org/repos/asf/drill/commit/09aa34b6
Tree: http://git-wip-us.apache.org/repos/asf/drill/tree/09aa34b6
Diff: http://git-wip-us.apache.org/repos/asf/drill/diff/09aa34b6
Branch: refs/heads/master
Commit: 09aa34b68c97a20412e9917d2ab6bf182477beb4
Parents: 0ded899
Author: Jason Altekruse <al...@gmail.com>
Authored: Thu Nov 20 18:48:08 2014 -0800
Committer: Jason Altekruse <al...@gmail.com>
Committed: Fri Nov 28 22:28:25 2014 -0800
----------------------------------------------------------------------
.../drill/exec/physical/impl/flatten/FlattenRecordBatch.java | 2 ++
.../apache/drill/exec/physical/impl/flatten/TestFlatten.java | 5 +++++
.../src/test/resources/store/json/nested_repeated_map.json | 1 +
3 files changed, 8 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/drill/blob/09aa34b6/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 f606090..8d14d2e 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
@@ -262,6 +262,8 @@ public class FlattenRecordBatch extends AbstractSingleRecordBatch<FlattenPOP> {
// 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
container.addOrGet(vw.getField());
+ } else if (! (vw.getValueVector() instanceof RepeatedVector )) {
+ container.addOrGet(vw.getField());
} else {
TransferPair pair = getFlattenFieldTransferPair();
if (pair == null) {
http://git-wip-us.apache.org/repos/asf/drill/blob/09aa34b6/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 dcdbc8d..70e54ff 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
@@ -197,4 +197,9 @@ public class TestFlatten extends BaseTestQuery {
test("select flatten(rm) from cp.`/store/json/2_level_repeated_map.json`");
}
+ @Test
+ public void testDrill_1770() throws Exception {
+ test("select flatten(sub.fk.`value`) from (select flatten(kvgen(map)) fk from cp.`/store/json/nested_repeated_map.json`) sub");
+ }
+
}
http://git-wip-us.apache.org/repos/asf/drill/blob/09aa34b6/exec/java-exec/src/test/resources/store/json/nested_repeated_map.json
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/test/resources/store/json/nested_repeated_map.json b/exec/java-exec/src/test/resources/store/json/nested_repeated_map.json
new file mode 100644
index 0000000..3a80c49
--- /dev/null
+++ b/exec/java-exec/src/test/resources/store/json/nested_repeated_map.json
@@ -0,0 +1 @@
+{"map":{"rm": [ {"rptd": [{ "a": "foo"}]}]}}
\ No newline at end of file