Search in sources :

Example 1 with AnalyzedAlterTableDropCheckConstraint

use of io.crate.analyze.AnalyzedAlterTableDropCheckConstraint in project crate by crate.

the class AlterTableDropCheckConstraintPlan method bind.

@VisibleForTesting
public static BoundAddColumn bind(AnalyzedAlterTableDropCheckConstraint dropCheckConstraint) {
    DocTableInfo tableInfo = dropCheckConstraint.tableInfo();
    AnalyzedTableElements<Object> tableElementsBound = new AnalyzedTableElements<>();
    AlterTableAddColumnPlan.addExistingPrimaryKeys(tableInfo, tableElementsBound);
    tableInfo.checkConstraints().stream().filter(c -> !dropCheckConstraint.name().equals(c.name())).forEach(c -> tableElementsBound.addCheckConstraint(tableInfo.ident(), c));
    return new BoundAddColumn(tableInfo, tableElementsBound, Settings.builder().build(), AnalyzedTableElements.finalizeAndValidate(tableInfo.ident(), new AnalyzedTableElements<>(), tableElementsBound), false, false);
}
Also used : AnalyzedTableElements(io.crate.analyze.AnalyzedTableElements) DocTableInfo(io.crate.metadata.doc.DocTableInfo) BoundAddColumn(io.crate.analyze.BoundAddColumn) AnalyzedAlterTableDropCheckConstraint(io.crate.analyze.AnalyzedAlterTableDropCheckConstraint) RowConsumer(io.crate.data.RowConsumer) DependencyCarrier(io.crate.planner.DependencyCarrier) AnalyzedTableElements(io.crate.analyze.AnalyzedTableElements) Settings(org.elasticsearch.common.settings.Settings) Row(io.crate.data.Row) PlannerContext(io.crate.planner.PlannerContext) Plan(io.crate.planner.Plan) SubQueryResults(io.crate.planner.operators.SubQueryResults) VisibleForTesting(io.crate.common.annotations.VisibleForTesting) OneRowActionListener(io.crate.execution.support.OneRowActionListener) Row1(io.crate.data.Row1) DocTableInfo(io.crate.metadata.doc.DocTableInfo) BoundAddColumn(io.crate.analyze.BoundAddColumn) VisibleForTesting(io.crate.common.annotations.VisibleForTesting)

Aggregations

AnalyzedAlterTableDropCheckConstraint (io.crate.analyze.AnalyzedAlterTableDropCheckConstraint)1 AnalyzedTableElements (io.crate.analyze.AnalyzedTableElements)1 BoundAddColumn (io.crate.analyze.BoundAddColumn)1 VisibleForTesting (io.crate.common.annotations.VisibleForTesting)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 DocTableInfo (io.crate.metadata.doc.DocTableInfo)1 DependencyCarrier (io.crate.planner.DependencyCarrier)1 Plan (io.crate.planner.Plan)1 PlannerContext (io.crate.planner.PlannerContext)1 SubQueryResults (io.crate.planner.operators.SubQueryResults)1 Settings (org.elasticsearch.common.settings.Settings)1