From 2ef1136ab21a29b9634acc873c12da88a7e6f8b5 Mon Sep 17 00:00:00 2001 From: Fangjin Yang Date: Fri, 9 Nov 2012 13:39:02 -0800 Subject: [PATCH] fix a bug where intervals were being returned as String instead of Interval objects by the compute nodes --- .../metamx/druid/client/CachingClusteredClient.java | 2 +- .../metamx/druid/query/BySegmentQueryRunner.java | 4 ++-- .../druid/query/FinalizeResultsQueryRunner.java | 2 +- .../druid/result/BySegmentResultValueClass.java | 13 +++++++------ 4 files changed, 11 insertions(+), 10 deletions(-) diff --git a/client/src/main/java/com/metamx/druid/client/CachingClusteredClient.java b/client/src/main/java/com/metamx/druid/client/CachingClusteredClient.java index 6c7e588a6b7..c49e095d2ad 100644 --- a/client/src/main/java/com/metamx/druid/client/CachingClusteredClient.java +++ b/client/src/main/java/com/metamx/druid/client/CachingClusteredClient.java @@ -291,7 +291,7 @@ public class CachingClusteredClient implements QueryRunner final Iterable 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( diff --git a/client/src/main/java/com/metamx/druid/query/BySegmentQueryRunner.java b/client/src/main/java/com/metamx/druid/query/BySegmentQueryRunner.java index 1ecea33117f..4713fc8207a 100644 --- a/client/src/main/java/com/metamx/druid/query/BySegmentQueryRunner.java +++ b/client/src/main/java/com/metamx/druid/query/BySegmentQueryRunner.java @@ -72,7 +72,7 @@ public class BySegmentQueryRunner implements QueryRunner new BySegmentResultValueClass( results, segmentIdentifier, - query.getIntervals().get(0).toString() + query.getIntervals().get(0) ) ) ); @@ -90,7 +90,7 @@ public class BySegmentQueryRunner implements QueryRunner new BySegmentResultValueClass( results, segmentIdentifier, - query.getIntervals().get(0).toString() + query.getIntervals().get(0) ) ) ); diff --git a/client/src/main/java/com/metamx/druid/query/FinalizeResultsQueryRunner.java b/client/src/main/java/com/metamx/druid/query/FinalizeResultsQueryRunner.java index 22f11bb07a8..e54dd9d172a 100644 --- a/client/src/main/java/com/metamx/druid/query/FinalizeResultsQueryRunner.java +++ b/client/src/main/java/com/metamx/druid/query/FinalizeResultsQueryRunner.java @@ -81,7 +81,7 @@ public class FinalizeResultsQueryRunner implements QueryRunner new BySegmentResultValueClass( Lists.transform(resultsClass.getResults(), baseFinalizer), resultsClass.getSegmentId(), - resultsClass.getIntervalString() + resultsClass.getInterval() ) ); } diff --git a/client/src/main/java/com/metamx/druid/result/BySegmentResultValueClass.java b/client/src/main/java/com/metamx/druid/result/BySegmentResultValueClass.java index 24d9637ae84..fb1e0df8e22 100644 --- a/client/src/main/java/com/metamx/druid/result/BySegmentResultValueClass.java +++ b/client/src/main/java/com/metamx/druid/result/BySegmentResultValueClass.java @@ -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 { private final List results; private final String segmentId; - private final String intervalString; + private final Interval interval; public BySegmentResultValueClass( @JsonProperty("results") List 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 } @JsonProperty("interval") - public String getIntervalString() + public Interval getInterval() { - return intervalString; + return interval; } @Override @@ -66,7 +67,7 @@ public class BySegmentResultValueClass return "BySegmentTimeseriesResultValue{" + "results=" + results + ", segmentId='" + segmentId + '\'' + - ", intervalString='" + intervalString + '\'' + + ", interval='" + interval + '\'' + '}'; } }