use of io.crate.analyze.BoundAlterTable 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.analyze.BoundAlterTable in project crate by crate.
the class AlterTablePlan method bind.
public static BoundAlterTable bind(AnalyzedAlterTable analyzedAlterTable, CoordinatorTxnCtx txnCtx, NodeContext nodeCtx, Row params, SubQueryResults subQueryResults) {
Function<? super Symbol, Object> eval = x -> SymbolEvaluator.evaluate(txnCtx, nodeCtx, x, params, subQueryResults);
DocTableInfo docTableInfo = analyzedAlterTable.tableInfo();
AlterTable<Object> alterTable = analyzedAlterTable.alterTable().map(eval);
Table<Object> table = alterTable.table();
PartitionName partitionName = PartitionPropertiesAnalyzer.createPartitionName(table.partitionProperties(), docTableInfo);
TableParameters tableParameters = getTableParameterInfo(table, partitionName);
TableParameter tableParameter = getTableParameter(alterTable, tableParameters);
maybeRaiseBlockedException(docTableInfo, tableParameter.settings());
return new BoundAlterTable(docTableInfo, partitionName, tableParameter, table.excludePartitions(), docTableInfo.isPartitioned());
}
use of io.crate.analyze.BoundAlterTable in project crate by crate.
the class AlterTablePlan method executeOrFail.
@Override
public void executeOrFail(DependencyCarrier dependencies, PlannerContext plannerContext, RowConsumer consumer, Row params, SubQueryResults subQueryResults) throws Exception {
BoundAlterTable stmt = bind(alterTable, plannerContext.transactionContext(), dependencies.nodeContext(), params, subQueryResults);
dependencies.alterTableOperation().executeAlterTable(stmt).whenComplete(new OneRowActionListener<>(consumer, rCount -> new Row1(rCount == null ? -1 : rCount)));
}
Aggregations