@SuppressWarnings("unchecked") private Sequence<T> getSimpleServerResults( final QueryRunner serverRunner, final MultipleSpecificSegmentSpec segmentsOfServerSpec ) { return serverRunner.run(queryPlus.withQuerySegmentSpec(segmentsOfServerSpec), responseContext); }
final QueryPlus<T> retryQueryPlus = queryPlus.withQuerySegmentSpec( new MultipleSpecificSegmentSpec( missingSegments
@SuppressWarnings("unchecked") private Sequence<T> getBySegmentServerResults( final QueryRunner serverRunner, final MultipleSpecificSegmentSpec segmentsOfServerSpec ) { Sequence<Result<BySegmentResultValueClass<T>>> resultsBySegments = serverRunner .run(queryPlus.withQuerySegmentSpec(segmentsOfServerSpec), responseContext); // bySegment results need to be de-serialized, see DirectDruidClient.run() return (Sequence<T>) resultsBySegments .map(result -> result.map( resultsOfSegment -> resultsOfSegment.mapResults( toolChest.makePreComputeManipulatorFn(query, MetricManipulatorFns.deserializing())::apply ) )); }
@Override public Sequence<T> apply(Interval singleInterval) { return new AsyncQueryRunner<T>( //Note: it is assumed that toolChest.mergeResults(..) gives a query runner that is //not lazy i.e. it does most of its work on call to run() method toolChest.mergeResults( new MetricsEmittingQueryRunner<T>( emitter, toolChest, baseRunner, QueryMetrics::reportIntervalChunkTime, queryMetrics -> queryMetrics.chunkInterval(singleInterval) ).withWaitMeasuredFromNow() ), executor, queryWatcher ).run( queryPlus.withQuerySegmentSpec( new MultipleIntervalSegmentSpec(Collections.singletonList(singleInterval))), responseContext ); } }
@Override public Sequence<T> run(final QueryPlus<T> input, final Map<String, Object> responseContext) final QueryPlus<T> queryPlus = input.withQuerySegmentSpec(specificSpec); final Query<T> query = queryPlus.getQuery();
return Sequences.map( baseRunner.run( queryPlus.withQuerySegmentSpec(new MultipleIntervalSegmentSpec(Arrays.asList(modifiedInterval))), responseContext ),
queryPlus .withQuery((Query<Result<BySegmentResultValueClass<T>>>) downstreamQuery) .withQuerySegmentSpec(segmentsOfServerSpec), responseContext );