fix some interval bugs

This commit is contained in:
fjy 2013-04-23 16:53:57 -07:00
parent 7184e528fd
commit 13b617cfa9
4 changed files with 21 additions and 10 deletions

View File

@ -59,7 +59,7 @@
<dependency>
<groupId>com.metamx</groupId>
<artifactId>emitter</artifactId>
<version>0.2.0</version>
<version>0.2.3</version>
</dependency>
<dependency>
<groupId>com.metamx</groupId>

View File

@ -115,11 +115,14 @@ public class IncrementalIndexStorageAdapter implements StorageAdapter
public Iterable<Cursor> 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());
}
@ -404,8 +407,12 @@ 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"
);

View File

@ -137,11 +137,14 @@ public class QueryableIndexStorageAdapter extends BaseStorageAdapter
public Iterable<Cursor> 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());
}

View File

@ -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;