mirror of https://github.com/apache/druid.git
fix some interval bugs
This commit is contained in:
parent
7184e528fd
commit
13b617cfa9
2
pom.xml
2
pom.xml
|
@ -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>
|
||||
|
|
|
@ -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());
|
||||
}
|
||||
|
@ -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<String>()
|
||||
{
|
||||
|
@ -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"
|
||||
);
|
||||
}
|
||||
};
|
||||
|
|
|
@ -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());
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue