diff --git a/pom.xml b/pom.xml index adbd2b56516..fed2583d303 100644 --- a/pom.xml +++ b/pom.xml @@ -59,7 +59,7 @@ com.metamx emitter - 0.2.0 + 0.2.3 com.metamx diff --git a/server/src/main/java/com/metamx/druid/index/v1/IncrementalIndexStorageAdapter.java b/server/src/main/java/com/metamx/druid/index/v1/IncrementalIndexStorageAdapter.java index 479e93bf99e..9e5694ef4e4 100644 --- a/server/src/main/java/com/metamx/druid/index/v1/IncrementalIndexStorageAdapter.java +++ b/server/src/main/java/com/metamx/druid/index/v1/IncrementalIndexStorageAdapter.java @@ -115,11 +115,14 @@ public class IncrementalIndexStorageAdapter implements StorageAdapter public Iterable makeCursors(final Filter filter, final Interval interval, final QueryGranularity gran) { Interval actualIntervalTmp = interval; - Interval dataInterval = getInterval(); - if (!actualIntervalTmp.overlaps(dataInterval)) { + final Interval indexInterval = getInterval(); + + if (!actualIntervalTmp.overlaps(indexInterval)) { return ImmutableList.of(); } + final Interval dataInterval = new Interval(getMinTime().getMillis(), gran.next(getMaxTime().getMillis())); + if (actualIntervalTmp.getStart().isBefore(dataInterval.getStart())) { actualIntervalTmp = actualIntervalTmp.withStart(dataInterval.getStart()); } @@ -367,7 +370,7 @@ public class IncrementalIndexStorageAdapter implements StorageAdapter final String columnName = column.toLowerCase(); final Integer metricIndexInt = index.getMetricIndex(columnName); - if(metricIndexInt != null) { + if (metricIndexInt != null) { final int metricIndex = metricIndexInt; final ComplexMetricSerde serde = ComplexMetrics.getSerdeForType(index.getMetricType(columnName)); @@ -390,7 +393,7 @@ public class IncrementalIndexStorageAdapter implements StorageAdapter final Integer dimensionIndexInt = index.getDimensionIndex(columnName); - if(dimensionIndexInt != null) { + if (dimensionIndexInt != null) { final int dimensionIndex = dimensionIndexInt; return new ObjectColumnSelector() { @@ -404,10 +407,14 @@ public class IncrementalIndexStorageAdapter implements StorageAdapter public String get() { final String[] dimVals = currEntry.getKey().getDims()[dimensionIndex]; - if(dimVals.length == 1) return dimVals[0]; - if(dimVals.length == 0) return null; + if (dimVals.length == 1) { + return dimVals[0]; + } + if (dimVals.length == 0) { + return null; + } throw new UnsupportedOperationException( - "makeObjectColumnSelector does not support multivalued columns" + "makeObjectColumnSelector does not support multivalued columns" ); } }; diff --git a/server/src/main/java/com/metamx/druid/index/v1/QueryableIndexStorageAdapter.java b/server/src/main/java/com/metamx/druid/index/v1/QueryableIndexStorageAdapter.java index b0238b16d7e..2d55d425077 100644 --- a/server/src/main/java/com/metamx/druid/index/v1/QueryableIndexStorageAdapter.java +++ b/server/src/main/java/com/metamx/druid/index/v1/QueryableIndexStorageAdapter.java @@ -137,11 +137,14 @@ public class QueryableIndexStorageAdapter extends BaseStorageAdapter public Iterable makeCursors(Filter filter, Interval interval, QueryGranularity gran) { Interval actualInterval = interval; - final Interval dataInterval = getInterval(); - if (!actualInterval.overlaps(dataInterval)) { + final Interval indexInterval = getInterval(); + + if (!actualInterval.overlaps(indexInterval)) { return ImmutableList.of(); } + final Interval dataInterval = new Interval(getMinTime().getMillis(), gran.next(getMaxTime().getMillis())); + if (actualInterval.getStart().isBefore(dataInterval.getStart())) { actualInterval = actualInterval.withStart(dataInterval.getStart()); } diff --git a/server/src/main/java/com/metamx/druid/query/QueryRunnerHelper.java b/server/src/main/java/com/metamx/druid/query/QueryRunnerHelper.java index d2b4e656360..411542ffe4d 100644 --- a/server/src/main/java/com/metamx/druid/query/QueryRunnerHelper.java +++ b/server/src/main/java/com/metamx/druid/query/QueryRunnerHelper.java @@ -21,6 +21,7 @@ package com.metamx.druid.query; import com.google.common.base.Function; import com.google.common.base.Preconditions; +import com.google.common.primitives.Longs; import com.metamx.common.guava.FunctionalIterable; import com.metamx.common.logger.Logger; import com.metamx.druid.QueryGranularity;