Search in sources :

Example 1 with AnalyzedAlterTable

use of io.crate.analyze.AnalyzedAlterTable 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());
}
Also used : AlterTable(io.crate.sql.tree.AlterTable) AnalyzedAlterTable(io.crate.analyze.AnalyzedAlterTable) BoundAlterTable(io.crate.analyze.BoundAlterTable) IndexMetadata(org.elasticsearch.cluster.metadata.IndexMetadata) PartitionPropertiesAnalyzer(io.crate.analyze.PartitionPropertiesAnalyzer) Operation(io.crate.metadata.table.Operation) Function(java.util.function.Function) PartitionName(io.crate.metadata.PartitionName) DependencyCarrier(io.crate.planner.DependencyCarrier) SymbolEvaluator(io.crate.analyze.SymbolEvaluator) Settings(org.elasticsearch.common.settings.Settings) OneRowActionListener(io.crate.execution.support.OneRowActionListener) Nullable(javax.annotation.Nullable) TableParameter(io.crate.analyze.TableParameter) DocTableInfo(io.crate.metadata.doc.DocTableInfo) TableInfo(io.crate.metadata.table.TableInfo) NodeContext(io.crate.metadata.NodeContext) TablePropertiesAnalyzer(io.crate.analyze.TablePropertiesAnalyzer) Table(io.crate.sql.tree.Table) TableParameters(io.crate.analyze.TableParameters) RowConsumer(io.crate.data.RowConsumer) Row(io.crate.data.Row) Symbol(io.crate.expression.symbol.Symbol) PlannerContext(io.crate.planner.PlannerContext) Plan(io.crate.planner.Plan) SubQueryResults(io.crate.planner.operators.SubQueryResults) Row1(io.crate.data.Row1) CoordinatorTxnCtx(io.crate.metadata.CoordinatorTxnCtx) PartitionName(io.crate.metadata.PartitionName) DocTableInfo(io.crate.metadata.doc.DocTableInfo) BoundAlterTable(io.crate.analyze.BoundAlterTable) TableParameter(io.crate.analyze.TableParameter) TableParameters(io.crate.analyze.TableParameters)

Aggregations

AnalyzedAlterTable (io.crate.analyze.AnalyzedAlterTable)1 BoundAlterTable (io.crate.analyze.BoundAlterTable)1 PartitionPropertiesAnalyzer (io.crate.analyze.PartitionPropertiesAnalyzer)1 SymbolEvaluator (io.crate.analyze.SymbolEvaluator)1 TableParameter (io.crate.analyze.TableParameter)1 TableParameters (io.crate.analyze.TableParameters)1 TablePropertiesAnalyzer (io.crate.analyze.TablePropertiesAnalyzer)1 Row (io.crate.data.Row)1 Row1 (io.crate.data.Row1)1 RowConsumer (io.crate.data.RowConsumer)1 OneRowActionListener (io.crate.execution.support.OneRowActionListener)1 Symbol (io.crate.expression.symbol.Symbol)1 CoordinatorTxnCtx (io.crate.metadata.CoordinatorTxnCtx)1 NodeContext (io.crate.metadata.NodeContext)1 PartitionName (io.crate.metadata.PartitionName)1 DocTableInfo (io.crate.metadata.doc.DocTableInfo)1 Operation (io.crate.metadata.table.Operation)1 TableInfo (io.crate.metadata.table.TableInfo)1 DependencyCarrier (io.crate.planner.DependencyCarrier)1 Plan (io.crate.planner.Plan)1