fix cache not preserving timezone information

This commit is contained in:
xvrl 2013-01-21 14:21:01 -08:00
parent 07131c51ed
commit 068ca67dba
1 changed files with 3 additions and 2 deletions

View File

@ -191,7 +191,8 @@ public class TimeseriesQueryQueryToolChest implements QueryToolChest<Result<Time
TimeseriesResultValue results = input.getValue(); TimeseriesResultValue results = input.getValue();
final List<Object> retVal = Lists.newArrayListWithCapacity(1 + aggs.size()); final List<Object> retVal = Lists.newArrayListWithCapacity(1 + aggs.size());
retVal.add(input.getTimestamp().getMillis()); // make sure to preserve timezone information when caching results
retVal.add(input.getTimestamp());
for (AggregatorFactory agg : aggs) { for (AggregatorFactory agg : aggs) {
retVal.add(results.getMetric(agg.getName())); retVal.add(results.getMetric(agg.getName()));
} }
@ -215,7 +216,7 @@ public class TimeseriesQueryQueryToolChest implements QueryToolChest<Result<Time
Iterator<AggregatorFactory> aggsIter = aggs.iterator(); Iterator<AggregatorFactory> aggsIter = aggs.iterator();
Iterator<Object> resultIter = results.iterator(); Iterator<Object> resultIter = results.iterator();
DateTime timestamp = new DateTime(resultIter.next()); DateTime timestamp = (DateTime)resultIter.next();
while (aggsIter.hasNext() && resultIter.hasNext()) { while (aggsIter.hasNext() && resultIter.hasNext()) {
final AggregatorFactory factory = aggsIter.next(); final AggregatorFactory factory = aggsIter.next();
retVal.put(factory.getName(), factory.deserialize(resultIter.next())); retVal.put(factory.getName(), factory.deserialize(resultIter.next()));