From 93f97a5d865d4184b2a2fc2ca8e10df183d38eb4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Xavier=20L=C3=A9aut=C3=A9?= Date: Fri, 13 Jun 2014 13:20:14 -0700 Subject: [PATCH] fix bysegment-query-runner --- .../io/druid/query/BySegmentQueryRunner.java | 37 +++---------------- 1 file changed, 6 insertions(+), 31 deletions(-) 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);