use of io.crate.sql.tree.AlterTable in project crate by crate.
the class AlterTableAnalyzer method analyze.
public AlterTableAnalyzedStatement analyze(AlterTable node, Row parameters, String defaultSchema) {
Table table = node.table();
DocTableInfo tableInfo = schemas.getWritableTable(TableIdent.of(table, defaultSchema));
PartitionName partitionName = getPartitionName(table.partitionProperties(), tableInfo, parameters);
TableParameterInfo tableParameterInfo = getTableParameterInfo(table, tableInfo, partitionName);
TableParameter tableParameter = getTableParameter(node, parameters, tableParameterInfo);
maybeRaiseBlockedException(tableInfo, tableParameter.settings());
return new AlterTableAnalyzedStatement(tableInfo, partitionName, tableParameter, table.excludePartitions());
}
use of io.crate.sql.tree.AlterTable 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.sql.tree.AlterTable 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.sql.tree.AlterTable 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