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();
cachePopulatorMap.get(
String.format("%s_%s", segmentIdentifier, value.getIntervalString())
String.format("%s_%s", segmentIdentifier, value.getInterval())
).populate(Iterables.transform(segmentResults, prepareForCache));
return Sequences.simple(

View File

@ -72,7 +72,7 @@ public class BySegmentQueryRunner<T> implements QueryRunner<T>
new BySegmentResultValueClass<T>(
results,
segmentIdentifier,
query.getIntervals().get(0).toString()
query.getIntervals().get(0)
)
)
);
@ -90,7 +90,7 @@ public class BySegmentQueryRunner<T> implements QueryRunner<T>
new BySegmentResultValueClass<T>(
results,
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(
Lists.transform(resultsClass.getResults(), baseFinalizer),
resultsClass.getSegmentId(),
resultsClass.getIntervalString()
resultsClass.getInterval()
)
);
}

View File

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