diff --git a/processing/src/main/java/io/druid/query/BySegmentQueryRunner.java b/processing/src/main/java/io/druid/query/BySegmentQueryRunner.java index 44094d0216a..355f7538b9f 100644 --- a/processing/src/main/java/io/druid/query/BySegmentQueryRunner.java +++ b/processing/src/main/java/io/druid/query/BySegmentQueryRunner.java @@ -28,6 +28,7 @@ import com.metamx.common.guava.Yielders; import com.metamx.common.guava.YieldingAccumulator; import org.joda.time.DateTime; +import java.util.Arrays; import java.util.List; /** @@ -55,15 +56,10 @@ public class BySegmentQueryRunner implements QueryRunner { if (query.getContextBySegment(false)) { final Sequence baseSequence = base.run(query); - return new Sequence() - { - @Override - public OutType accumulate(OutType initValue, Accumulator accumulator) - { - List results = Sequences.toList(baseSequence, Lists.newArrayList()); - return accumulator.accumulate( - initValue, + final List results = Sequences.toList(baseSequence, Lists.newArrayList()); + return Sequences.simple( + Arrays.asList( (T) new Result>( timestamp, new BySegmentResultValueClass( @@ -72,29 +68,8 @@ public class BySegmentQueryRunner implements QueryRunner query.getIntervals().get(0) ) ) - ); - } - - @Override - public Yielder toYielder(OutType initValue, YieldingAccumulator accumulator) - { - List results = Sequences.toList(baseSequence, Lists.newArrayList()); - - final OutType retVal = accumulator.accumulate( - initValue, - (T) new Result>( - timestamp, - new BySegmentResultValueClass( - results, - segmentIdentifier, - query.getIntervals().get(0) - ) - ) - ); - - return Yielders.done(retVal, null); - } - }; + ) + ); } return base.run(query);