use of io.crate.planner.DependencyCarrier in project crate by crate.
the class UpdateSettingsPlan method executeOrFail.
@Override
public void executeOrFail(DependencyCarrier dependencies, PlannerContext plannerContext, RowConsumer consumer, Row params, SubQueryResults subQueryResults) {
Function<? super Symbol, Object> eval = x -> SymbolEvaluator.evaluate(plannerContext.transactionContext(), plannerContext.nodeContext(), x, params, subQueryResults);
ClusterUpdateSettingsRequest request = isPersistent ? new ClusterUpdateSettingsRequest().persistentSettings(buildSettingsFrom(settings, eval)) : new ClusterUpdateSettingsRequest().transientSettings(buildSettingsFrom(settings, eval));
OneRowActionListener<ClusterUpdateSettingsResponse> actionListener = new OneRowActionListener<>(consumer, r -> r.isAcknowledged() ? new Row1(1L) : new Row1(0L));
dependencies.transportActionProvider().transportClusterUpdateSettingsAction().execute(request, actionListener);
}
use of io.crate.planner.DependencyCarrier in project crate by crate.
the class DeletePartitions method executeOrFail.
@Override
public void executeOrFail(DependencyCarrier dependencies, PlannerContext plannerContext, RowConsumer consumer, Row params, SubQueryResults subQueryResults) {
ArrayList<String> indexNames = getIndices(plannerContext.transactionContext(), dependencies.nodeContext(), params, subQueryResults);
DeleteIndexRequest request = new DeleteIndexRequest(indexNames.toArray(new String[0]));
request.indicesOptions(IndicesOptions.lenientExpandOpen());
dependencies.transportActionProvider().transportDeleteIndexAction().execute(request, new OneRowActionListener<>(consumer, r -> Row1.ROW_COUNT_UNKNOWN));
}
use of io.crate.planner.DependencyCarrier in project crate by crate.
the class DropSnapshotPlan method executeOrFail.
@Override
public void executeOrFail(DependencyCarrier dependencies, PlannerContext plannerContext, RowConsumer consumer, Row parameters, SubQueryResults subQueryResult) {
DeleteSnapshotRequest request = new DeleteSnapshotRequest(dropSnapshot.repository(), dropSnapshot.snapshot());
var transportDeleteSnapshotAction = dependencies.transportActionProvider().transportDeleteSnapshotAction();
transportDeleteSnapshotAction.execute(request, new OneRowActionListener<>(consumer, response -> {
if (!response.isAcknowledged()) {
LOGGER.info("delete snapshot '{}.{}' not acknowledged", request.repository(), request.snapshot());
}
return new Row1(1L);
}));
}
use of io.crate.planner.DependencyCarrier 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.planner.DependencyCarrier in project crate by crate.
the class SQLIntegrationTestCase method execute.
public TestingRowConsumer execute(PlanForNode planForNode) {
DependencyCarrier dependencyCarrier = internalCluster().getInstance(DependencyCarrier.class, planForNode.nodeName);
TestingRowConsumer downstream = new TestingRowConsumer();
planForNode.plan.execute(dependencyCarrier, planForNode.plannerContext, downstream, Row.EMPTY, SubQueryResults.EMPTY);
return downstream;
}
Aggregations