use of io.crate.data.RowConsumer in project crate by crate.
the class AlterTableAddColumnPlan method executeOrFail.
@Override
public void executeOrFail(DependencyCarrier dependencies, PlannerContext plannerContext, RowConsumer consumer, Row params, SubQueryResults subQueryResults) throws Exception {
BoundAddColumn stmt = bind(alterTable, plannerContext.transactionContext(), dependencies.nodeContext(), params, subQueryResults, dependencies.fulltextAnalyzerResolver());
dependencies.alterTableOperation().executeAlterTableAddColumn(stmt).whenComplete(new OneRowActionListener<>(consumer, rCount -> new Row1(rCount == null ? -1 : rCount)));
}
use of io.crate.data.RowConsumer in project crate by crate.
the class ExplainPlannerTest method testExplainAnalyzeMultiPhasePlanNotSupported.
@Test
public void testExplainAnalyzeMultiPhasePlanNotSupported() {
ExplainPlan plan = e.plan("EXPLAIN ANALYZE SELECT * FROM users WHERE name = (SELECT 'crate') or id = (SELECT 1)");
PlannerContext plannerContext = e.getPlannerContext(clusterService.state());
CountDownLatch counter = new CountDownLatch(1);
AtomicReference<BatchIterator<Row>> itRef = new AtomicReference<>();
AtomicReference<Throwable> failureRef = new AtomicReference<>();
plan.execute(null, plannerContext, new RowConsumer() {
@Override
public void accept(BatchIterator<Row> iterator, @Nullable Throwable failure) {
itRef.set(iterator);
failureRef.set(failure);
counter.countDown();
}
@Override
public CompletableFuture<?> completionFuture() {
return null;
}
}, Row.EMPTY, SubQueryResults.EMPTY);
assertNull(itRef.get());
assertNotNull(failureRef.get());
assertThat(failureRef.get().getMessage(), containsString("EXPLAIN ANALYZE does not support profiling multi-phase plans, such as queries with scalar subselects."));
}
Aggregations