You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@drill.apache.org by ja...@apache.org on 2014/04/20 06:08:14 UTC

[06/17] git commit: DRILL-456: Remove extra row in the output of grouped aggregate query.

DRILL-456: Remove extra row in the output of grouped aggregate query.


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

Branch: refs/heads/master
Commit: 9d7bb0625b9194014b5b26f3e7cb7b5618dc1a3f
Parents: 41dcf20
Author: Aman Sinha <as...@maprtech.com>
Authored: Mon Apr 14 15:30:09 2014 -0700
Committer: Jacques Nadeau <ja...@apache.org>
Committed: Sat Apr 19 21:07:24 2014 -0700

----------------------------------------------------------------------
 .../exec/physical/impl/aggregate/StreamingAggTemplate.java   | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/9d7bb062/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/aggregate/StreamingAggTemplate.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/aggregate/StreamingAggTemplate.java b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/aggregate/StreamingAggTemplate.java
index f0cb0d4..e3eb6fe 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/aggregate/StreamingAggTemplate.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/aggregate/StreamingAggTemplate.java
@@ -34,7 +34,7 @@ public abstract class StreamingAggTemplate implements StreamingAggregator {
   private IterOutcome lastOutcome = null;
   private boolean first = true;
   private boolean newSchema = false;
-  private int previousIndex = 0;
+  private int previousIndex = -1;
   private int underlyingIndex = 0;
   private int currentIndex;
   private int addedRecordCount = 0;
@@ -123,7 +123,11 @@ public abstract class StreamingAggTemplate implements StreamingAggregator {
       // loop through existing records, adding as necessary.
         for (; underlyingIndex < incoming.getRecordCount(); incIndex()) {
           if(EXTRA_DEBUG) logger.debug("Doing loop with values underlying {}, current {}", underlyingIndex, currentIndex);
-          if (isSame( previousIndex, currentIndex )) {
+          if (previousIndex == -1) {
+            if (EXTRA_DEBUG) logger.debug("Adding the initial row's keys and values.");
+            addRecordInc(currentIndex);
+          }
+          else if (isSame( previousIndex, currentIndex )) {
             if(EXTRA_DEBUG) logger.debug("Values were found the same, adding.");
             addRecordInc(currentIndex);
           } else {