fix a bug where intervals were being returned as String instead of Interval objects by the compute nodes

This commit is contained in:
Fangjin Yang 2012-11-09 13:39:02 -08:00
parent 0b7a3f259a
commit 2ef1136ab2
4 changed files with 11 additions and 10 deletions

View File

@ -291,7 +291,7 @@ public class CachingClusteredClient<T> implements QueryRunner<T>
final Iterable<T> segmentResults = value.getResults(); final Iterable<T> segmentResults = value.getResults();
cachePopulatorMap.get( cachePopulatorMap.get(
String.format("%s_%s", segmentIdentifier, value.getIntervalString()) String.format("%s_%s", segmentIdentifier, value.getInterval())
).populate(Iterables.transform(segmentResults, prepareForCache)); ).populate(Iterables.transform(segmentResults, prepareForCache));
return Sequences.simple( return Sequences.simple(

View File

@ -72,7 +72,7 @@ public class BySegmentQueryRunner<T> implements QueryRunner<T>
new BySegmentResultValueClass<T>( new BySegmentResultValueClass<T>(
results, results,
segmentIdentifier, segmentIdentifier,
query.getIntervals().get(0).toString() query.getIntervals().get(0)
) )
) )
); );
@ -90,7 +90,7 @@ public class BySegmentQueryRunner<T> implements QueryRunner<T>
new BySegmentResultValueClass<T>( new BySegmentResultValueClass<T>(
results, results,
segmentIdentifier, segmentIdentifier,
query.getIntervals().get(0).toString() query.getIntervals().get(0)
) )
) )
); );

View File

@ -81,7 +81,7 @@ public class FinalizeResultsQueryRunner<T> implements QueryRunner<T>
new BySegmentResultValueClass( new BySegmentResultValueClass(
Lists.transform(resultsClass.getResults(), baseFinalizer), Lists.transform(resultsClass.getResults(), baseFinalizer),
resultsClass.getSegmentId(), resultsClass.getSegmentId(),
resultsClass.getIntervalString() resultsClass.getInterval()
) )
); );
} }

View File

@ -20,6 +20,7 @@
package com.metamx.druid.result; package com.metamx.druid.result;
import org.codehaus.jackson.annotate.JsonProperty; import org.codehaus.jackson.annotate.JsonProperty;
import org.joda.time.Interval;
import java.util.List; import java.util.List;
@ -29,17 +30,17 @@ public class BySegmentResultValueClass<T>
{ {
private final List<T> results; private final List<T> results;
private final String segmentId; private final String segmentId;
private final String intervalString; private final Interval interval;
public BySegmentResultValueClass( public BySegmentResultValueClass(
@JsonProperty("results") List<T> results, @JsonProperty("results") List<T> results,
@JsonProperty("segment") String segmentId, @JsonProperty("segment") String segmentId,
@JsonProperty("interval") String intervalString @JsonProperty("interval") Interval interval
) )
{ {
this.results = results; this.results = results;
this.segmentId = segmentId; this.segmentId = segmentId;
this.intervalString = intervalString; this.interval = interval;
} }
@JsonProperty("results") @JsonProperty("results")
@ -55,9 +56,9 @@ public class BySegmentResultValueClass<T>
} }
@JsonProperty("interval") @JsonProperty("interval")
public String getIntervalString() public Interval getInterval()
{ {
return intervalString; return interval;
} }
@Override @Override
@ -66,7 +67,7 @@ public class BySegmentResultValueClass<T>
return "BySegmentTimeseriesResultValue{" + return "BySegmentTimeseriesResultValue{" +
"results=" + results + "results=" + results +
", segmentId='" + segmentId + '\'' + ", segmentId='" + segmentId + '\'' +
", intervalString='" + intervalString + '\'' + ", interval='" + interval + '\'' +
'}'; '}';
} }
} }