diff --git a/client/pom.xml b/client/pom.xml index eea2eb34ca7..b19cac12b06 100644 --- a/client/pom.xml +++ b/client/pom.xml @@ -28,7 +28,7 @@ com.metamx druid - 0.5.49-SNAPSHOT + 0.5.50-SNAPSHOT diff --git a/common/pom.xml b/common/pom.xml index 2c513ff5fb0..fba4b3c660e 100644 --- a/common/pom.xml +++ b/common/pom.xml @@ -28,7 +28,7 @@ com.metamx druid - 0.5.49-SNAPSHOT + 0.5.50-SNAPSHOT diff --git a/examples/config/realtime/runtime.properties b/examples/config/realtime/runtime.properties index 4af1b7908ec..b7366c20595 100644 --- a/examples/config/realtime/runtime.properties +++ b/examples/config/realtime/runtime.properties @@ -6,11 +6,6 @@ druid.service=realtime com.metamx.emitter.logging=true com.metamx.emitter.logging.level=info -# zk -druid.zk.service.host=localhost -druid.zk.paths.base=/druid -druid.zk.paths.discoveryPath=/druid/discoveryPath - # processing druid.processing.buffer.sizeBytes=10000000 @@ -34,4 +29,4 @@ druid.paths.indexCache=/tmp/druid/indexCache # handoff druid.pusher.local.storageDirectory=/tmp/druid/localStorage -druid.pusher.local=true \ No newline at end of file +druid.pusher.local=true diff --git a/examples/pom.xml b/examples/pom.xml index 52354413e9f..54155a54ce3 100644 --- a/examples/pom.xml +++ b/examples/pom.xml @@ -9,7 +9,7 @@ com.metamx druid - 0.5.49-SNAPSHOT + 0.5.50-SNAPSHOT diff --git a/indexing-common/pom.xml b/indexing-common/pom.xml index 8a6506752ae..6bd76a53385 100644 --- a/indexing-common/pom.xml +++ b/indexing-common/pom.xml @@ -28,7 +28,7 @@ com.metamx druid - 0.5.49-SNAPSHOT + 0.5.50-SNAPSHOT diff --git a/indexing-hadoop/pom.xml b/indexing-hadoop/pom.xml index 16ceb208213..be2d75deff9 100644 --- a/indexing-hadoop/pom.xml +++ b/indexing-hadoop/pom.xml @@ -28,7 +28,7 @@ com.metamx druid - 0.5.49-SNAPSHOT + 0.5.50-SNAPSHOT diff --git a/indexing-service/pom.xml b/indexing-service/pom.xml index f1b41640bd4..5c4898be390 100644 --- a/indexing-service/pom.xml +++ b/indexing-service/pom.xml @@ -28,7 +28,7 @@ com.metamx druid - 0.5.49-SNAPSHOT + 0.5.50-SNAPSHOT diff --git a/pom.xml b/pom.xml index 7af362cd5b6..7c6c323b069 100644 --- a/pom.xml +++ b/pom.xml @@ -23,7 +23,7 @@ com.metamx druid pom - 0.5.49-SNAPSHOT + 0.5.50-SNAPSHOT druid druid diff --git a/realtime/pom.xml b/realtime/pom.xml index c79dfa7e3f4..d97e2da4d9c 100644 --- a/realtime/pom.xml +++ b/realtime/pom.xml @@ -28,7 +28,7 @@ com.metamx druid - 0.5.49-SNAPSHOT + 0.5.50-SNAPSHOT diff --git a/server/pom.xml b/server/pom.xml index 9a85f526a04..86b3718b7dc 100644 --- a/server/pom.xml +++ b/server/pom.xml @@ -28,7 +28,7 @@ com.metamx druid - 0.5.49-SNAPSHOT + 0.5.50-SNAPSHOT diff --git a/server/src/main/java/com/metamx/druid/query/group/GroupByQueryEngine.java b/server/src/main/java/com/metamx/druid/query/group/GroupByQueryEngine.java index 600461d0974..526cb8cc3c4 100644 --- a/server/src/main/java/com/metamx/druid/query/group/GroupByQueryEngine.java +++ b/server/src/main/java/com/metamx/druid/query/group/GroupByQueryEngine.java @@ -53,6 +53,7 @@ import org.joda.time.Interval; import javax.annotation.Nullable; import java.nio.ByteBuffer; +import java.util.ArrayList; import java.util.Iterator; import java.util.List; import java.util.Map; @@ -281,7 +282,7 @@ public class GroupByQueryEngine private final List dimensionSpecs; private final List dimensions; - private final String[] dimNames; + private final ArrayList dimNames; private final List aggregatorSpecs; private final BufferAggregator[] aggregators; private final String[] metricNames; @@ -301,14 +302,14 @@ public class GroupByQueryEngine delegate = Iterators.emptyIterator(); dimensionSpecs = query.getDimensions(); dimensions = Lists.newArrayListWithExpectedSize(dimensionSpecs.size()); - dimNames = new String[dimensionSpecs.size()]; + dimNames = Lists.newArrayListWithExpectedSize(dimensionSpecs.size()); for (int i = 0; i < dimensionSpecs.size(); ++i) { final DimensionSpec dimSpec = dimensionSpecs.get(i); final DimensionSelector selector = cursor.makeDimensionSelector(dimSpec.getDimension()); if (selector != null) { dimensions.add(selector); + dimNames.add(dimSpec.getOutputName()); } - dimNames[i] = dimSpec.getOutputName(); } aggregatorSpecs = query.getAggregatorSpecs(); @@ -384,7 +385,7 @@ public class GroupByQueryEngine ByteBuffer keyBuffer = input.getKey().duplicate(); for (int i = 0; i < dimensions.size(); ++i) { - theEvent.put(dimNames[i], dimensions.get(i).lookupName(keyBuffer.getInt())); + theEvent.put(dimNames.get(i), dimensions.get(i).lookupName(keyBuffer.getInt())); } int position = input.getValue(); diff --git a/server/src/test/java/com/metamx/druid/query/group/GroupByQueryRunnerTest.java b/server/src/test/java/com/metamx/druid/query/group/GroupByQueryRunnerTest.java index a06161e5b4c..66129edcffb 100644 --- a/server/src/test/java/com/metamx/druid/query/group/GroupByQueryRunnerTest.java +++ b/server/src/test/java/com/metamx/druid/query/group/GroupByQueryRunnerTest.java @@ -700,6 +700,41 @@ public class GroupByQueryRunnerTest TestHelper.assertExpectedObjects(expectedResults, mergeRunner.run(query), "no-limit"); } + @Test + public void testGroupByWithNonexistantDimension() throws Exception + { + GroupByQuery.Builder builder = GroupByQuery + .builder() + .setDataSource(QueryRunnerTestHelper.dataSource) + .setInterval("2011-04-02/2011-04-04") + .addDimension("billy") + .addDimension("quality") + .setAggregatorSpecs( + Arrays.asList( + QueryRunnerTestHelper.rowsCount + ) + ) + .setGranularity(new PeriodGranularity(new Period("P1M"), null, null)); + + final GroupByQuery query = builder.build(); + + List expectedResults = Arrays.asList( + createExpectedRow("2011-04-01", "quality", "automotive", "rows", 2L), + createExpectedRow("2011-04-01", "quality", "business", "rows", 2L), + createExpectedRow("2011-04-01", "quality", "entertainment", "rows", 2L), + createExpectedRow("2011-04-01", "quality", "health", "rows", 2L), + createExpectedRow("2011-04-01", "quality", "mezzanine", "rows", 6L), + createExpectedRow("2011-04-01", "quality", "news", "rows", 2L), + createExpectedRow("2011-04-01", "quality", "premium", "rows", 6L), + createExpectedRow("2011-04-01", "quality", "technology", "rows", 2L), + createExpectedRow("2011-04-01", "quality", "travel", "rows", 2L) + ); + + TestHelper.assertExpectedObjects(expectedResults, runner.run(query), "normal"); + QueryRunner mergeRunner = new GroupByQueryQueryToolChest().mergeResults(runner); + TestHelper.assertExpectedObjects(expectedResults, mergeRunner.run(query), "no-limit"); + } + private Row createExpectedRow(final String timestamp, Object... vals) { return createExpectedRow(new DateTime(timestamp), vals); diff --git a/services/pom.xml b/services/pom.xml index 90565d6ef18..9a877f5007d 100644 --- a/services/pom.xml +++ b/services/pom.xml @@ -24,11 +24,11 @@ druid-services druid-services druid-services - 0.5.49-SNAPSHOT + 0.5.50-SNAPSHOT com.metamx druid - 0.5.49-SNAPSHOT + 0.5.50-SNAPSHOT