assume segment intervals have already been filtered based on query interval

This commit is contained in:
xvrl 2013-02-11 16:55:21 -08:00
parent e9f546c4ca
commit 6b87ef2921
1 changed files with 15 additions and 22 deletions

View File

@ -21,7 +21,6 @@ package com.metamx.druid.query.timeboundary;
import com.google.common.base.Function;
import com.google.common.base.Functions;
import com.google.common.collect.Iterables;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.google.common.collect.Ordering;
@ -39,15 +38,12 @@ import com.metamx.druid.query.QueryToolChest;
import com.metamx.druid.query.segment.SegmentDescriptor;
import com.metamx.druid.result.Result;
import com.metamx.druid.result.TimeBoundaryResultValue;
import com.metamx.druid.utils.JodaUtils;
import com.metamx.emitter.service.ServiceMetricEvent;
import org.codehaus.jackson.type.TypeReference;
import org.joda.time.DateTime;
import org.joda.time.Interval;
import javax.annotation.Nullable;
import java.nio.ByteBuffer;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
@ -77,9 +73,7 @@ public class TimeBoundaryQueryQueryToolChest
// keep track of all segments in a given shard
Map<String, Set<SegmentDescriptor>> segmentGroups = Maps.newHashMap();
Iterable<Interval> condensedIntervals = JodaUtils.condenseIntervals(query.getIntervals());
for(SegmentDescriptor e : input) {
if(Iterables.isEmpty(condensedIntervals) || JodaUtils.overlaps(e.getInterval(), condensedIntervals)) {
final long start = e.getInterval().getStartMillis();
final long end = e.getInterval().getEndMillis();
final String version = e.getVersion();
@ -99,7 +93,6 @@ public class TimeBoundaryQueryQueryToolChest
maxMillis = end;
}
}
}
return Sets.union(segmentGroups.get(min.getVersion()), segmentGroups.get(max.getVersion()));
}