You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@druid.apache.org by GitBox <gi...@apache.org> on 2018/07/30 03:41:55 UTC

[GitHub] asdf2014 commented on a change in pull request #6062: Fix a bug in GroupByQueryEngine

asdf2014 commented on a change in pull request #6062: Fix a bug in GroupByQueryEngine
URL: https://github.com/apache/incubator-druid/pull/6062#discussion_r206008884
 
 

 ##########
 File path: processing/src/main/java/io/druid/query/groupby/GroupByQueryEngine.java
 ##########
 @@ -178,37 +178,33 @@ public int getNumRows()
       return positions;
     }
 
-    private List<ByteBuffer> updateValues(
-        ByteBuffer key,
-        List<DimensionSelector> dims
-    )
+    @Nullable
+    private List<ByteBuffer> updateValues(ByteBuffer key, List<DimensionSelector> dims)
     {
       if (dims.size() > 0) {
-        List<ByteBuffer> retVal = null;
-        List<ByteBuffer> unaggregatedBuffers = null;
-
         final DimensionSelector dimSelector = dims.get(0);
         final IndexedInts row = dimSelector.getRow();
         final int rowSize = row.size();
         if (rowSize == 0) {
           ByteBuffer newKey = key.duplicate();
           newKey.putInt(MISSING_VALUE);
-          unaggregatedBuffers = updateValues(newKey, dims.subList(1, dims.size()));
+          return updateValues(newKey, dims.subList(1, dims.size()));
         } else {
+          List<ByteBuffer> retVal = null;
           for (int i = 0; i < rowSize; i++) {
             ByteBuffer newKey = key.duplicate();
             int dimValue = row.get(i);
             newKey.putInt(dimValue);
-            unaggregatedBuffers = updateValues(newKey, dims.subList(1, dims.size()));
-          }
-        }
-        if (unaggregatedBuffers != null) {
-          if (retVal == null) {
-            retVal = Lists.newArrayList();
+            List<ByteBuffer> unaggregatedBuffers = updateValues(newKey, dims.subList(1, dims.size()));
 
 Review comment:
   We should extract the `dims.size()` as a variable, and put it at the beginning of this method.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org