use of io.crate.planner.operators.SubQueryResults in project crate by crate.
the class DeleteAllPartitions method executeOrFail.
@Override
public void executeOrFail(DependencyCarrier executor, PlannerContext plannerContext, RowConsumer consumer, Row params, SubQueryResults subQueryResults) {
if (partitions.isEmpty()) {
consumer.accept(InMemoryBatchIterator.of(new Row1(0L), SentinelRow.SENTINEL), null);
} else {
/*
* table is partitioned, in case of concurrent "delete from partitions"
* it could be that some partitions are already deleted,
* so ignore it if some are missing
*/
DeleteIndexRequest deleteIndexRequest = new DeleteIndexRequest(partitions().toArray(new String[0])).indicesOptions(IndicesOptions.lenientExpandOpen());
executor.transportActionProvider().transportDeleteIndexAction().execute(deleteIndexRequest, new OneRowActionListener<>(consumer, r -> Row1.ROW_COUNT_UNKNOWN));
}
}
use of io.crate.planner.operators.SubQueryResults in project crate by crate.
the class DropAnalyzerPlan method executeOrFail.
@Override
public void executeOrFail(DependencyCarrier dependencies, PlannerContext plannerContext, RowConsumer consumer, Row params, SubQueryResults subQueryResults) {
ClusterUpdateSettingsRequest request = createRequest(dropAnalyzer.name(), dependencies.fulltextAnalyzerResolver());
dependencies.transportActionProvider().transportClusterUpdateSettingsAction().execute(request, new OneRowActionListener<>(consumer, r -> new Row1(1L)));
}
use of io.crate.planner.operators.SubQueryResults 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.operators.SubQueryResults 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.operators.SubQueryResults 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);
}));
}
Aggregations