MCPcopy Create free account
hub / github.com/crate/crate / DropViewPlan

Class DropViewPlan

server/src/main/java/io/crate/planner/DropViewPlan.java:37–66  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

35import io.crate.planner.operators.SubQueryResults;
36
37public class DropViewPlan implements Plan {
38
39 private final AnalyzedDropView dropView;
40
41 DropViewPlan(AnalyzedDropView dropView) {
42 this.dropView = dropView;
43 }
44
45 @Override
46 public StatementType type() {
47 return StatementType.DDL;
48 }
49
50 @Override
51 public void executeOrFail(DependencyCarrier dependencies,
52 PlannerContext plannerContext,
53 RowConsumer consumer,
54 Row params,
55 SubQueryResults subQueryResults) {
56 DropViewRequest request = new DropViewRequest(dropView.views(), dropView.ifExists());
57 Function<DropViewResponse, Row> responseToRow = resp -> {
58 if (dropView.ifExists() || resp.missing().isEmpty()) {
59 return new Row1((long) dropView.views().size() - resp.missing().size());
60 }
61 throw new RelationsUnknown(resp.missing());
62 };
63 dependencies.client().execute(TransportDropView.ACTION, request)
64 .whenComplete(new OneRowActionListener<>(consumer, responseToRow));
65 }
66}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected