Skip to content

Commit 675f92a

Browse files
authored
CardinalityPreserving->Streaming + reword (#137041) (#137048)
* Rename CardinalityPreserving -> Streaming * Reword the definition and give a precise, formal version of it so we can more easily check it against new commands.
1 parent 45d4ae8 commit 675f92a

File tree

13 files changed

+72
-50
lines changed

13 files changed

+72
-50
lines changed

x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/optimizer/rules/logical/HoistRemoteEnrichLimit.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@
88
package org.elasticsearch.xpack.esql.optimizer.rules.logical;
99

1010
import org.elasticsearch.xpack.esql.optimizer.LogicalOptimizerContext;
11-
import org.elasticsearch.xpack.esql.plan.logical.CardinalityPreserving;
1211
import org.elasticsearch.xpack.esql.plan.logical.Enrich;
1312
import org.elasticsearch.xpack.esql.plan.logical.ExecutesOn;
1413
import org.elasticsearch.xpack.esql.plan.logical.Limit;
1514
import org.elasticsearch.xpack.esql.plan.logical.LogicalPlan;
1615
import org.elasticsearch.xpack.esql.plan.logical.PipelineBreaker;
16+
import org.elasticsearch.xpack.esql.plan.logical.Streaming;
1717

1818
import java.util.Collections;
1919
import java.util.Comparator;
@@ -46,8 +46,8 @@ protected LogicalPlan rule(Enrich en, LogicalOptimizerContext ctx) {
4646
seenLimits.add(l);
4747
return;
4848
}
49-
if ((p instanceof CardinalityPreserving) == false // can change the number of rows, so we can't just pull a limit from
50-
// under it
49+
if ((p instanceof Streaming) == false // can change the number of rows, so we can't just pull a limit from
50+
// under it
5151
// this will fail the verifier anyway, so no need to continue
5252
|| (p instanceof ExecutesOn ex && ex.executesOn() == ExecutesOn.ExecuteLocation.COORDINATOR)
5353
// This is essentially another remote enrich - let it take care of its own limits

x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/optimizer/rules/logical/HoistRemoteEnrichTopN.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@
1515
import org.elasticsearch.xpack.esql.core.expression.NamedExpression;
1616
import org.elasticsearch.xpack.esql.core.util.Holder;
1717
import org.elasticsearch.xpack.esql.expression.Order;
18-
import org.elasticsearch.xpack.esql.plan.logical.CardinalityPreserving;
1918
import org.elasticsearch.xpack.esql.plan.logical.Enrich;
2019
import org.elasticsearch.xpack.esql.plan.logical.Eval;
2120
import org.elasticsearch.xpack.esql.plan.logical.ExecutesOn;
2221
import org.elasticsearch.xpack.esql.plan.logical.LogicalPlan;
2322
import org.elasticsearch.xpack.esql.plan.logical.PipelineBreaker;
2423
import org.elasticsearch.xpack.esql.plan.logical.Project;
24+
import org.elasticsearch.xpack.esql.plan.logical.Streaming;
2525
import org.elasticsearch.xpack.esql.plan.logical.TopN;
2626
import org.elasticsearch.xpack.esql.plan.logical.UnaryPlan;
2727

@@ -132,8 +132,8 @@ protected LogicalPlan rule(Enrich en) {
132132
return new Project(en.source(), copyTop, outputs);
133133
}
134134
}
135-
if ((plan instanceof CardinalityPreserving) == false // can change the number of rows, so we can't just pull a TopN from
136-
// under it
135+
if ((plan instanceof Streaming) == false // can change the number of rows, so we can't just pull a TopN from
136+
// under it
137137
// this will fail the verifier anyway, so no need to continue
138138
|| (plan instanceof ExecutesOn ex && ex.executesOn() == ExecutesOn.ExecuteLocation.COORDINATOR)
139139
// This is another remote Enrich, it can handle its own limits

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

Lines changed: 0 additions & 34 deletions
This file was deleted.

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
import java.util.List;
1818
import java.util.Objects;
1919

20-
public class Drop extends UnaryPlan implements TelemetryAware, CardinalityPreserving, SortAgnostic {
20+
public class Drop extends UnaryPlan implements TelemetryAware, Streaming, SortAgnostic {
2121
private final List<NamedExpression> removals;
2222

2323
public Drop(Source source, LogicalPlan child, List<NamedExpression> removals) {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public class Enrich extends UnaryPlan
5151
PostOptimizationVerificationAware.CoordinatorOnly,
5252
PostAnalysisVerificationAware,
5353
TelemetryAware,
54-
CardinalityPreserving,
54+
Streaming,
5555
SortAgnostic,
5656
ExecutesOn {
5757
public static final NamedWriteableRegistry.Entry ENTRY = new NamedWriteableRegistry.Entry(

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public class Eval extends UnaryPlan
4141
GeneratingPlan<Eval>,
4242
PostAnalysisVerificationAware,
4343
TelemetryAware,
44-
CardinalityPreserving,
44+
Streaming,
4545
SortAgnostic {
4646
public static final NamedWriteableRegistry.Entry ENTRY = new NamedWriteableRegistry.Entry(LogicalPlan.class, "Eval", Eval::new);
4747

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
import java.util.List;
1919
import java.util.Objects;
2020

21-
public class Insist extends UnaryPlan implements SurrogateLogicalPlan, CardinalityPreserving {
21+
public class Insist extends UnaryPlan implements SurrogateLogicalPlan, Streaming {
2222
private final List<? extends Attribute> insistedAttributes;
2323
private @Nullable List<Attribute> lazyOutput = null;
2424

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
import java.util.List;
1616
import java.util.Objects;
1717

18-
public class Keep extends Project implements TelemetryAware, CardinalityPreserving, SortAgnostic {
18+
public class Keep extends Project implements TelemetryAware, Streaming, SortAgnostic {
1919

2020
public Keep(Source source, LogicalPlan child, List<? extends NamedExpression> projections) {
2121
super(source, child, projections);

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
/**
2828
* A {@code Project} is a {@code Plan} with one child. In {@code FROM idx | KEEP x, y}, the {@code KEEP} statement is a Project.
2929
*/
30-
public class Project extends UnaryPlan implements CardinalityPreserving, SortAgnostic {
30+
public class Project extends UnaryPlan implements Streaming, SortAgnostic {
3131
public static final NamedWriteableRegistry.Entry ENTRY = new NamedWriteableRegistry.Entry(LogicalPlan.class, "Project", Project::new);
3232

3333
private final List<? extends NamedExpression> projections;

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public abstract class RegexExtract extends UnaryPlan
2828
implements
2929
GeneratingPlan<RegexExtract>,
3030
PostAnalysisVerificationAware,
31-
CardinalityPreserving,
31+
Streaming,
3232
SortAgnostic {
3333
protected final Expression input;
3434
protected final List<Attribute> extractedFields;

0 commit comments

Comments
 (0)