You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@druid.apache.org by gi...@apache.org on 2018/07/30 21:39:41 UTC
[incubator-druid] branch master updated: Fix a bug in
GroupByQueryEngine (#6062)
This is an automated email from the ASF dual-hosted git repository.
gian pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-druid.git
The following commit(s) were added to refs/heads/master by this push:
new f3595c9 Fix a bug in GroupByQueryEngine (#6062)
f3595c9 is described below
commit f3595c93d92f39298956a27691e93cf3459fb5fb
Author: Roman Leventov <le...@gmail.com>
AuthorDate: Mon Jul 30 16:39:38 2018 -0500
Fix a bug in GroupByQueryEngine (#6062)
---
.../io/druid/query/groupby/GroupByQueryEngine.java | 30 ++++++++++------------
1 file changed, 13 insertions(+), 17 deletions(-)
diff --git a/processing/src/main/java/io/druid/query/groupby/GroupByQueryEngine.java b/processing/src/main/java/io/druid/query/groupby/GroupByQueryEngine.java
index d3543cd..1d77d08 100644
--- a/processing/src/main/java/io/druid/query/groupby/GroupByQueryEngine.java
+++ b/processing/src/main/java/io/druid/query/groupby/GroupByQueryEngine.java
@@ -178,37 +178,33 @@ public class GroupByQueryEngine
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()));
+ if (unaggregatedBuffers != null) {
+ if (retVal == null) {
+ retVal = Lists.newArrayList();
+ }
+ retVal.addAll(unaggregatedBuffers);
+ }
}
- retVal.addAll(unaggregatedBuffers);
+ return retVal;
}
- return retVal;
} else {
key.clear();
Integer position = positionsHash.get(key);
@@ -222,7 +218,7 @@ public class GroupByQueryEngine
position = positionMaintainer.getNext();
if (position == null) {
- return Lists.newArrayList(keyCopy);
+ return Collections.singletonList(keyCopy);
}
positions.put(keyCopy, position);
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org