drill-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From par...@apache.org
Subject [1/5] drill git commit: DRILL-2099: Fix flatten after sort
Date Tue, 24 Mar 2015 19:41:07 GMT
Repository: drill
Updated Branches:
  refs/heads/master e796b91aa -> 2019d336c


DRILL-2099: Fix flatten after sort


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

Branch: refs/heads/master
Commit: 2019d336c92a774c0a3a1bdb1a051665f92fc3eb
Parents: 07a9817
Author: Mehant Baid <mehantr@gmail.com>
Authored: Mon Mar 23 14:20:28 2015 -0700
Committer: Parth Chandra <pchandra@maprtech.com>
Committed: Tue Mar 24 12:12:19 2015 -0700

----------------------------------------------------------------------
 .../org/apache/drill/exec/record/VectorContainer.java   |  2 +-
 .../drill/exec/physical/impl/flatten/TestFlatten.java   | 12 ++++++++++++
 .../src/test/resources/flatten/drill-2099-result.json   |  5 +++++
 .../src/test/resources/jsoninput/flatten_post_sort.json |  7 +++++++
 4 files changed, 25 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/drill/blob/2019d336/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 2d60567..5a192a0 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
@@ -88,7 +88,7 @@ public class VectorContainer implements Iterable<VectorWrapper<?>>,
VectorAccess
         return (T) newVector;
       }
     } else {
-      v = TypeHelper.getNewVector(field, this.oContext.getAllocator());
+      v = TypeHelper.getNewVector(field, this.oContext.getAllocator(), callBack);
       add(v);
     }
     return (T) v;

http://git-wip-us.apache.org/repos/asf/drill/blob/2019d336/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 415296f..b9bd99f 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
@@ -293,4 +293,16 @@ public class TestFlatten extends BaseTestQuery {
     test(q1);
     test(q2);
   }
+
+  @Test //DRILL-2099
+  public void testFlattenAfterSort() throws Exception {
+    String query = "select flatten(s1.rms.rptd) rptds from " +
+        "(select d.uid uid, flatten(d.map.rm) rms from cp.`jsoninput/flatten_post_sort.json`
d order by d.uid) s1";
+
+    testBuilder()
+        .sqlQuery(query)
+        .unOrdered()
+        .jsonBaselineFile("flatten/drill-2099-result.json")
+        .go();
+  }
 }

http://git-wip-us.apache.org/repos/asf/drill/blob/2019d336/exec/java-exec/src/test/resources/flatten/drill-2099-result.json
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/test/resources/flatten/drill-2099-result.json b/exec/java-exec/src/test/resources/flatten/drill-2099-result.json
new file mode 100644
index 0000000..8d7ee2f
--- /dev/null
+++ b/exec/java-exec/src/test/resources/flatten/drill-2099-result.json
@@ -0,0 +1,5 @@
+{"rptds": {"a":"foo"}}
+{"rptds": {"b":"boo"}}
+{"rptds": {"a":"bar"}}
+{"rptds": {"c":1}}
+{"rptds": {"d":4.5}}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/drill/blob/2019d336/exec/java-exec/src/test/resources/jsoninput/flatten_post_sort.json
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/test/resources/jsoninput/flatten_post_sort.json b/exec/java-exec/src/test/resources/jsoninput/flatten_post_sort.json
new file mode 100644
index 0000000..8bfa2af
--- /dev/null
+++ b/exec/java-exec/src/test/resources/jsoninput/flatten_post_sort.json
@@ -0,0 +1,7 @@
+{
+  "uid" : 1,
+  "map":{"rm": [
+    {"rptd": [{ "a": "foo"},{"b":"boo"}]},
+    {"rptd": [{ "a": "bar"},{"c":1},{"d":4.5}]}
+  ]}
+}
\ No newline at end of file


Mime
View raw message