use of io.crate.execution.support.OneRowActionListener in project crate by crate.
the class AlterBlobTablePlan 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);
TableInfo tableInfo = analyzedAlterTable.tableInfo();
AlterTable<Object> alterTable = analyzedAlterTable.alterTable().map(eval);
TableParameter tableParameter = getTableParameter(alterTable, TableParameters.ALTER_BLOB_TABLE_PARAMETERS);
maybeRaiseBlockedException(tableInfo, tableParameter.settings());
BoundAlterTable stmt = new BoundAlterTable(tableInfo, null, tableParameter, true, false);
dependencies.alterTableOperation().executeAlterTable(stmt).whenComplete(new OneRowActionListener<>(consumer, rCount -> new Row1(rCount == null ? -1 : rCount)));
}
use of io.crate.execution.support.OneRowActionListener 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.execution.support.OneRowActionListener in project crate by crate.
the class CreateBlobTablePlan method executeOrFail.
@Override
public void executeOrFail(DependencyCarrier dependencies, PlannerContext plannerContext, RowConsumer consumer, Row params, SubQueryResults subQueryResults) throws Exception {
RelationName relationName = analyzedBlobTable.relationName();
Settings settings = buildSettings(analyzedBlobTable.createBlobTable(), plannerContext.transactionContext(), dependencies.nodeContext(), params, subQueryResults, numberOfShards);
CreateIndexRequest createIndexRequest = new CreateIndexRequest(fullIndexName(relationName.name()), settings);
OneRowActionListener<CreateIndexResponse> listener = new OneRowActionListener<>(consumer, r -> new Row1(1L));
dependencies.createIndexAction().execute(createIndexRequest, listener);
}
use of io.crate.execution.support.OneRowActionListener 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.execution.support.OneRowActionListener in project crate by crate.
the class DropFunctionPlan method executeOrFail.
@Override
public void executeOrFail(DependencyCarrier dependencies, PlannerContext plannerContext, RowConsumer consumer, Row params, SubQueryResults subQueryResults) throws Exception {
DropUserDefinedFunctionRequest request = new DropUserDefinedFunctionRequest(analyzedDropFunction.schema(), analyzedDropFunction.name(), analyzedDropFunction.argumentTypes(), analyzedDropFunction.ifExists());
OneRowActionListener<AcknowledgedResponse> listener = new OneRowActionListener<>(consumer, r -> new Row1(1L));
dependencies.dropFunctionAction().execute(request, listener);
}
Aggregations