drill-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j...@apache.org
Subject [4/9] drill git commit: DRILL-2013: Fix flatten when no rows match filters
Date Fri, 27 Feb 2015 08:01:58 GMT
DRILL-2013: Fix flatten when no rows match filters


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

Branch: refs/heads/master
Commit: ce0afb1d62b519772084173ed5540cda79a2719b
Parents: 1d2ed34
Author: AdamPD <adam@pharmadata.net.au>
Authored: Fri Jan 23 17:01:36 2015 +1000
Committer: Jason Altekruse <altekrusejason@gmail.com>
Committed: Thu Feb 26 16:41:03 2015 -0800

----------------------------------------------------------------------
 .../drill/exec/physical/impl/flatten/FlattenRecordBatch.java    | 2 +-
 .../apache/drill/exec/physical/impl/flatten/TestFlatten.java    | 5 +++++
 2 files changed, 6 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/drill/blob/ce0afb1d/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 02c154f..8a87098 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
@@ -152,7 +152,7 @@ public class FlattenRecordBatch extends AbstractSingleRecordBatch<FlattenPOP>
{
     // inside of the the flattener for the current batch
     setFlattenVector();
 
-    int childCount = flattener.getFlattenField().getAccessor().getValueCount();
+    int childCount = incomingRecordCount == 0 ? 0 : flattener.getFlattenField().getAccessor().getValueCount();
     int outputRecords = flattener.flattenRecords(0, incomingRecordCount, 0);
     // TODO - change this to be based on the repeated vector length
     if (outputRecords < childCount) {

http://git-wip-us.apache.org/repos/asf/drill/blob/ce0afb1d/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 b56df84..9518386 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
@@ -241,4 +241,9 @@ public class TestFlatten extends BaseTestQuery {
   }
 
 
+  @Test
+  public void testDrill_2013() throws Exception {
+    test("select flatten(complex), rownum from cp.`/store/json/test_flatten_mappify2.json`
where rownum > 5");
+  }
+
 }


Mime
View raw message