use of io.crate.planner.operators.SubQueryResults in project crate by crate.
the class AlterUserPlan method executeOrFail.
@Override
public void executeOrFail(DependencyCarrier dependencies, PlannerContext plannerContext, RowConsumer consumer, Row params, SubQueryResults subQueryResults) throws Exception {
SecureHash newPassword = UserActions.generateSecureHash(alterUser.properties(), params, plannerContext.transactionContext(), plannerContext.nodeContext());
userManager.alterUser(alterUser.userName(), newPassword).whenComplete(new OneRowActionListener<>(consumer, rCount -> new Row1(rCount == null ? -1 : rCount)));
}
use of io.crate.planner.operators.SubQueryResults in project crate by crate.
the class CreateUserPlan method executeOrFail.
@Override
public void executeOrFail(DependencyCarrier dependencies, PlannerContext plannerContext, RowConsumer consumer, Row params, SubQueryResults subQueryResults) throws Exception {
SecureHash newPassword = UserActions.generateSecureHash(createUser.properties(), params, plannerContext.transactionContext(), plannerContext.nodeContext());
userManager.createUser(createUser.userName(), newPassword).whenComplete(new OneRowActionListener<>(consumer, rCount -> new Row1(rCount == null ? -1 : rCount)));
}
use of io.crate.planner.operators.SubQueryResults in project crate by crate.
the class ResetSettingsPlan 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);
Settings settings = buildSettingsFrom(resetAnalyzedStatement.settingsToRemove(), eval);
ClusterUpdateSettingsRequest request = new ClusterUpdateSettingsRequest().persistentSettings(settings).transientSettings(settings);
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 DecommissionNodePlan method executeOrFail.
@Override
public void executeOrFail(DependencyCarrier dependencies, PlannerContext plannerContext, RowConsumer consumer, Row params, SubQueryResults subQueryResults) {
var boundedNodeIdOrName = boundNodeIdOrName(analyzedDecommissionNode, plannerContext.transactionContext(), plannerContext.nodeContext(), params, subQueryResults);
String targetNodeId = NodeSelection.resolveNodeId(dependencies.clusterService().state().nodes(), boundedNodeIdOrName);
dependencies.transportActionProvider().transportDecommissionNodeAction().execute(targetNodeId, new DecommissionNodeRequest(), new OneRowActionListener<>(consumer, r -> r.isAcknowledged() ? new Row1(1L) : new Row1(0L)));
}
use of io.crate.planner.operators.SubQueryResults in project crate by crate.
the class SQLExecutor method planInternal.
private <T> T planInternal(AnalyzedStatement analyzedStatement, UUID jobId, int fetchSize, Row params) {
RoutingProvider routingProvider = new RoutingProvider(random.nextInt(), emptyList());
PlannerContext plannerContext = new PlannerContext(planner.currentClusterState(), routingProvider, jobId, coordinatorTxnCtx, nodeCtx, fetchSize, null);
Plan plan = planner.plan(analyzedStatement, plannerContext);
if (plan instanceof LogicalPlan) {
return (T) ((LogicalPlan) plan).build(plannerContext, Set.of(), new ProjectionBuilder(nodeCtx), TopN.NO_LIMIT, 0, null, null, params, new SubQueryResults(emptyMap()) {
@Override
public Object getSafe(SelectSymbol key) {
return Literal.of(key.valueType(), null);
}
});
}
return (T) plan;
}
Aggregations