@Override public Sequence<T> run(final QueryPlus<T> queryPlus, final Map<String, Object> responseContext) { return queryPlus.run(appenderator, responseContext); } };
@Override public <T> QueryRunner<T> getQueryRunner(Query<T> query) { if (appenderator == null) { // Not yet initialized, no data yet, just return a noop runner. return new NoopQueryRunner<>(); } return (queryPlus, responseContext) -> queryPlus.run(appenderator, responseContext); }
@Override public <T> QueryRunner<T> getQueryRunner(Query<T> query) { if (runner.getAppenderator() == null) { // Not yet initialized, no data yet, just return a noop runner. return new NoopQueryRunner<>(); } return (queryPlus, responseContext) -> queryPlus.run(runner.getAppenderator(), responseContext); }
@Benchmark @BenchmarkMode(Mode.AverageTime) @OutputTimeUnit(TimeUnit.MILLISECONDS) public void queryNative(Blackhole blackhole) { final Sequence<Row> resultSequence = QueryPlus.wrap(groupByQuery).run(walker, new HashMap<>()); final List<Row> resultList = resultSequence.toList(); for (Row row : resultList) { blackhole.consume(row); } }
/** * Execute the query. Can only be called if the query has been authorized. Note that query logs and metrics will * not be emitted automatically when the Sequence is fully iterated. It is the caller's responsibility to call * {@link #emitLogsAndMetrics(Throwable, String, long)} to emit logs and metrics. * * @return result sequence and response context */ public QueryResponse execute() { transition(State.AUTHORIZED, State.EXECUTING); final Map<String, Object> responseContext = DirectDruidClient.makeResponseContextForQuery(); final Sequence res = QueryPlus.wrap(baseQuery) .withIdentity(authenticationResult.getIdentity()) .run(texasRanger, responseContext); return new QueryResponse(res == null ? Sequences.empty() : res, responseContext); }
QueryPlus.wrap(query1).run(appenderator, ImmutableMap.of()).toList(); Assert.assertEquals( "query1", QueryPlus.wrap(query2).run(appenderator, ImmutableMap.of()).toList(); Assert.assertEquals( "query2", QueryPlus.wrap(query3).run(appenderator, ImmutableMap.of()).toList(); Assert.assertEquals( "query2",
QueryPlus.wrap(query1).run(appenderator, ImmutableMap.of()).toList(); Assert.assertEquals( "query1", QueryPlus.wrap(query2).run(appenderator, ImmutableMap.of()).toList(); Assert.assertEquals( "query2", QueryPlus.wrap(query3).run(appenderator, ImmutableMap.of()).toList(); Assert.assertEquals( ImmutableList.of( QueryPlus.wrap(query4).run(appenderator, ImmutableMap.of()).toList(); Assert.assertEquals( ImmutableList.of(
@Override public Sequence<T> run(final QueryPlus<T> queryPlus, final Map<String, Object> responseContext) { return queryPlus.run(appenderator, responseContext); } };
@Override public <T> QueryRunner<T> getQueryRunner(Query<T> query) { if (appenderator == null) { // Not yet initialized, no data yet, just return a noop runner. return new NoopQueryRunner<>(); } return (queryPlus, responseContext) -> queryPlus.run(appenderator, responseContext); }
/** * Execute the query. Can only be called if the query has been authorized. Note that query logs and metrics will * not be emitted automatically when the Sequence is fully iterated. It is the caller's responsibility to call * {@link #emitLogsAndMetrics(Throwable, String, long)} to emit logs and metrics. * * @return result sequence and response context */ public QueryResponse execute() { transition(State.AUTHORIZED, State.EXECUTING); final Map<String, Object> responseContext = DirectDruidClient.makeResponseContextForQuery(); final Sequence res = QueryPlus.wrap(baseQuery) .withIdentity(authenticationResult.getIdentity()) .run(texasRanger, responseContext); return new QueryResponse(res == null ? Sequences.empty() : res, responseContext); }