Skip to content

Commit fb221c9

Browse files
subquery serialization
1 parent f7d695d commit fb221c9

File tree

2 files changed

+3
-28
lines changed

2 files changed

+3
-28
lines changed

x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/plan/PlanWritables.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
import org.elasticsearch.xpack.esql.plan.logical.OrderBy;
2323
import org.elasticsearch.xpack.esql.plan.logical.Project;
2424
import org.elasticsearch.xpack.esql.plan.logical.Sample;
25+
import org.elasticsearch.xpack.esql.plan.logical.Subquery;
2526
import org.elasticsearch.xpack.esql.plan.logical.TimeSeriesAggregate;
2627
import org.elasticsearch.xpack.esql.plan.logical.TopN;
2728
import org.elasticsearch.xpack.esql.plan.logical.inference.Completion;
@@ -93,6 +94,7 @@ public static List<NamedWriteableRegistry.Entry> logical() {
9394
Project.ENTRY,
9495
Rerank.ENTRY,
9596
Sample.ENTRY,
97+
Subquery.ENTRY,
9698
TimeSeriesAggregate.ENTRY,
9799
TopN.ENTRY
98100
);

x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/plan/logical/Subquery.java

Lines changed: 1 addition & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,7 @@
99
import org.elasticsearch.common.io.stream.NamedWriteableRegistry;
1010
import org.elasticsearch.common.io.stream.StreamInput;
1111
import org.elasticsearch.common.io.stream.StreamOutput;
12-
import org.elasticsearch.xpack.esql.capabilities.PostAnalysisVerificationAware;
1312
import org.elasticsearch.xpack.esql.capabilities.TelemetryAware;
14-
import org.elasticsearch.xpack.esql.common.Failures;
1513
import org.elasticsearch.xpack.esql.core.expression.Attribute;
1614
import org.elasticsearch.xpack.esql.core.tree.NodeInfo;
1715
import org.elasticsearch.xpack.esql.core.tree.Source;
@@ -21,7 +19,7 @@
2119
import java.util.List;
2220
import java.util.Objects;
2321

24-
public class Subquery extends UnaryPlan implements PostAnalysisVerificationAware, TelemetryAware, SortAgnostic {
22+
public class Subquery extends UnaryPlan implements TelemetryAware, SortAgnostic {
2523
public static final NamedWriteableRegistry.Entry ENTRY = new NamedWriteableRegistry.Entry(LogicalPlan.class, "Subquery", Subquery::new);
2624

2725
// subquery alias/qualifier could be added in the future if needed
@@ -30,7 +28,6 @@ public Subquery(Source source, LogicalPlan subqueryPlan) {
3028
super(source, subqueryPlan);
3129
}
3230

33-
// TODO does Subquery need to be Serializable?
3431
private Subquery(StreamInput in) throws IOException {
3532
this(Source.readFrom((PlanStreamInput) in), in.readNamedWriteable(LogicalPlan.class));
3633
}
@@ -63,7 +60,6 @@ public List<Attribute> output() {
6360

6461
@Override
6562
public boolean expressionsResolved() {
66-
// TODO add if needed
6763
return true;
6864
}
6965

@@ -91,30 +87,7 @@ public String nodeString() {
9187
return nodeName() + "[]";
9288
}
9389

94-
@Override
95-
public void postAnalysisVerification(Failures failures) {
96-
// TODO add verification if needed
97-
}
98-
9990
public LogicalPlan plan() {
10091
return child();
10192
}
102-
103-
public boolean canMerge() {
104-
// if the subquery contains from/eval/where/subquery, it can be merged
105-
LogicalPlan child = child();
106-
if (child instanceof UnionAll unionAll) {
107-
for (LogicalPlan subPlan : unionAll.children()) {
108-
if (canMerge(subPlan) == false) {
109-
return false;
110-
}
111-
}
112-
}
113-
return true;
114-
}
115-
116-
// more plan types could be added if needed, non-pipeline breakers
117-
private boolean canMerge(LogicalPlan plan) {
118-
return plan instanceof Subquery || plan instanceof Filter || plan instanceof EsRelation;
119-
}
12093
}

0 commit comments

Comments
 (0)