Search in sources :

Example 1 with DropViewRequest

use of io.crate.execution.ddl.views.DropViewRequest in project crate by crate.

the class DropViewPlan method executeOrFail.

@Override
public void executeOrFail(DependencyCarrier dependencies, PlannerContext plannerContext, RowConsumer consumer, Row params, SubQueryResults subQueryResults) {
    DropViewRequest request = new DropViewRequest(dropView.views(), dropView.ifExists());
    Function<DropViewResponse, Row> responseToRow = resp -> {
        if (dropView.ifExists() || resp.missing().isEmpty()) {
            return new Row1((long) dropView.views().size() - resp.missing().size());
        }
        throw new RelationsUnknown(resp.missing());
    };
    dependencies.dropViewAction().execute(request, new OneRowActionListener<>(consumer, responseToRow));
}
Also used : RowConsumer(io.crate.data.RowConsumer) Row(io.crate.data.Row) RelationsUnknown(io.crate.exceptions.RelationsUnknown) SubQueryResults(io.crate.planner.operators.SubQueryResults) DropViewRequest(io.crate.execution.ddl.views.DropViewRequest) DropViewResponse(io.crate.execution.ddl.views.DropViewResponse) AnalyzedDropView(io.crate.analyze.AnalyzedDropView) OneRowActionListener(io.crate.execution.support.OneRowActionListener) Function(java.util.function.Function) Row1(io.crate.data.Row1) DropViewRequest(io.crate.execution.ddl.views.DropViewRequest) Row1(io.crate.data.Row1) DropViewResponse(io.crate.execution.ddl.views.DropViewResponse) RelationsUnknown(io.crate.exceptions.RelationsUnknown) Row(io.crate.data.Row)

Aggregations

AnalyzedDropView (io.crate.analyze.AnalyzedDropView)1 Row (io.crate.data.Row)1 Row1 (io.crate.data.Row1)1 RowConsumer (io.crate.data.RowConsumer)1 RelationsUnknown (io.crate.exceptions.RelationsUnknown)1 DropViewRequest (io.crate.execution.ddl.views.DropViewRequest)1 DropViewResponse (io.crate.execution.ddl.views.DropViewResponse)1 OneRowActionListener (io.crate.execution.support.OneRowActionListener)1 SubQueryResults (io.crate.planner.operators.SubQueryResults)1 Function (java.util.function.Function)1