Skip to content

Commit d0ff3e7

Browse files
[8.x] fix failing tests after pr conflict (#114707)
Two PRs conflicted without github or CI noticing. The first added these tests, and the second modified their behaviour. Both went green in CI and both were merged within an hour of each other. * PR that added the tests: * #112938 * merged 14:13CET * PR that changed the behaviour of these tests: * #114411 * merged 14:48CET
1 parent 4665615 commit d0ff3e7

File tree

2 files changed

+28
-36
lines changed

2 files changed

+28
-36
lines changed

muted-tests.yml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -342,12 +342,6 @@ tests:
342342
- class: org.elasticsearch.action.search.SearchQueryThenFetchAsyncActionTests
343343
method: testMinimumVersionShardDuringPhaseExecution
344344
issue: https://github.com/elastic/elasticsearch/issues/114611
345-
- class: org.elasticsearch.xpack.esql.optimizer.PhysicalPlanOptimizerTests
346-
method: testPushSpatialIntersectsEvalToSource {default}
347-
issue: https://github.com/elastic/elasticsearch/issues/114627
348-
- class: org.elasticsearch.xpack.esql.optimizer.PhysicalPlanOptimizerTests
349-
method: testPushWhereEvalToSource {default}
350-
issue: https://github.com/elastic/elasticsearch/issues/114628
351345

352346
# Examples:
353347
#

x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/optimizer/PhysicalPlanOptimizerTests.java

Lines changed: 28 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -3211,28 +3211,28 @@ public void testPushSpatialIntersectsStringToSource() {
32113211
/**
32123212
* Plan:
32133213
* <code>
3214-
* LimitExec[1000[INTEGER]]
3215-
* \_ExchangeExec[[],false]
3216-
* \_FragmentExec[filter=null, estimatedRowSize=0, reducer=[], fragment=[
3214+
* EvalExec[[scalerank{f}#8 AS rank]]
3215+
* \_LimitExec[1000[INTEGER]]
3216+
* \_ExchangeExec[[],false]
3217+
* \_FragmentExec[filter=null, estimatedRowSize=0, reducer=[], fragment=[
32173218
* Limit[1000[INTEGER]]
3218-
* \_Filter[rank{r}#4 lt 4[INTEGER]]
3219-
* \_Eval[[scalerank{f}#8 AS rank]]
3220-
* \_EsRelation[airports][abbrev{f}#6, city{f}#12, city_location{f}#13, count..]]]
3219+
* \_Filter[scalerank{f}#8 &lt; 4[INTEGER]]
3220+
* \_EsRelation[airports][abbrev{f}#6, city{f}#12, city_location{f}#13, count..]]]
32213221
* </code>
32223222
* Optimized:
32233223
* <code>
3224-
* LimitExec[1000[INTEGER]]
3225-
* \_ExchangeExec[[abbrev{f}#6, city{f}#12, city_location{f}#13, country{f}#11, location{f}#10, name{f}#7, scalerank{f}#8,
3226-
* type{f}#9, rank{r}#4],false]
3227-
* \_ProjectExec[[abbrev{f}#6, city{f}#12, city_location{f}#13, country{f}#11, location{f}#10, name{f}#7, scalerank{f}#8,
3228-
* type{f}#9, rank{r}#4]]
3229-
* \_FieldExtractExec[abbrev{f}#6, city{f}#12, city_location{f}#13, count..][]
3230-
* \_LimitExec[1000[INTEGER]]
3231-
* \_EvalExec[[scalerank{f}#8 AS rank]]
3232-
* \_FieldExtractExec[scalerank{f}#8][]
3233-
* \_EsQueryExec[airports], indexMode[standard], query[{"
3234-
* esql_single_value":{"field":"scalerank","next":{"range":{"scalerank":{"lt":4,"boost":1.0}}},"source":"rank &lt; 4@3:9"}
3235-
* }][_doc{f}#23], limit[], sort[] estimatedRowSize[304]
3224+
* EvalExec[[scalerank{f}#8 AS rank]]
3225+
* \_LimitExec[1000[INTEGER]]
3226+
* \_ExchangeExec[[abbrev{f}#6, city{f}#12, city_location{f}#13, country{f}#11, location{f}#10, name{f}#7, scalerank{f}#8,
3227+
* type{f}#9],false
3228+
* ]
3229+
* \_ProjectExec[[abbrev{f}#6, city{f}#12, city_location{f}#13, country{f}#11, location{f}#10, name{f}#7, scalerank{f}#8,
3230+
* type{f}#9]
3231+
* ]
3232+
* \_FieldExtractExec[abbrev{f}#6, city{f}#12, city_location{f}#13, count..][]
3233+
* \_EsQueryExec[airports], indexMode[standard], query[{
3234+
* "esql_single_value":{"field":"scalerank","next":{"range":{"scalerank":{"lt":4,"boost":1.0}}},"source":"rank &lt; 4@3:9"}
3235+
* ][_doc{f}#23], limit[1000], sort[] estimatedRowSize[304]
32363236
* </code>
32373237
*/
32383238
public void testPushWhereEvalToSource() {
@@ -3243,24 +3243,23 @@ public void testPushWhereEvalToSource() {
32433243
""";
32443244

32453245
var plan = this.physicalPlan(query, airports);
3246-
var limit = as(plan, LimitExec.class);
3246+
var eval = as(plan, EvalExec.class);
3247+
var limit = as(eval.child(), LimitExec.class);
32473248
var exchange = as(limit.child(), ExchangeExec.class);
32483249
var fragment = as(exchange.child(), FragmentExec.class);
32493250
var limit2 = as(fragment.fragment(), Limit.class);
32503251
var filter = as(limit2.child(), Filter.class);
32513252
assertThat("filter contains LessThan", filter.condition(), instanceOf(LessThan.class));
32523253

32533254
var optimized = optimizedPlan(plan);
3254-
var topLimit = as(optimized, LimitExec.class);
3255+
eval = as(optimized, EvalExec.class);
3256+
var topLimit = as(eval.child(), LimitExec.class);
32553257
exchange = as(topLimit.child(), ExchangeExec.class);
32563258
var project = as(exchange.child(), ProjectExec.class);
32573259
var fieldExtract = as(project.child(), FieldExtractExec.class);
32583260
assertThat(fieldExtract.attributesToExtract().size(), greaterThan(5));
3259-
limit = as(fieldExtract.child(), LimitExec.class);
3260-
var eval = as(limit.child(), EvalExec.class);
3261-
fieldExtract = as(eval.child(), FieldExtractExec.class);
3262-
assertThat(fieldExtract.attributesToExtract().stream().map(Attribute::name).collect(Collectors.toList()), contains("scalerank"));
32633261
var source = source(fieldExtract.child());
3262+
assertThat(source.limit(), is(topLimit.limit()));
32643263
var condition = as(source.query(), SingleValueQuery.Builder.class);
32653264
assertThat("Expected predicate to be passed to Lucene query", condition.source().text(), equalTo("rank < 4"));
32663265
assertThat("Expected field to be passed to Lucene query", condition.field(), equalTo("scalerank"));
@@ -3281,24 +3280,23 @@ public void testPushSpatialIntersectsEvalToSource() {
32813280
""" }) {
32823281

32833282
var plan = this.physicalPlan(query, airports);
3284-
var limit = as(plan, LimitExec.class);
3283+
var eval = as(plan, EvalExec.class);
3284+
var limit = as(eval.child(), LimitExec.class);
32853285
var exchange = as(limit.child(), ExchangeExec.class);
32863286
var fragment = as(exchange.child(), FragmentExec.class);
32873287
var limit2 = as(fragment.fragment(), Limit.class);
32883288
var filter = as(limit2.child(), Filter.class);
32893289
assertThat("filter contains ST_INTERSECTS", filter.condition(), instanceOf(SpatialIntersects.class));
32903290

32913291
var optimized = optimizedPlan(plan);
3292-
var topLimit = as(optimized, LimitExec.class);
3292+
eval = as(optimized, EvalExec.class);
3293+
var topLimit = as(eval.child(), LimitExec.class);
32933294
exchange = as(topLimit.child(), ExchangeExec.class);
32943295
var project = as(exchange.child(), ProjectExec.class);
32953296
var fieldExtract = as(project.child(), FieldExtractExec.class);
32963297
assertThat(fieldExtract.attributesToExtract().size(), greaterThan(5));
3297-
limit = as(fieldExtract.child(), LimitExec.class);
3298-
var eval = as(limit.child(), EvalExec.class);
3299-
fieldExtract = as(eval.child(), FieldExtractExec.class);
3300-
assertThat(fieldExtract.attributesToExtract().stream().map(Attribute::name).collect(Collectors.toList()), contains("location"));
33013298
var source = source(fieldExtract.child());
3299+
assertThat(source.limit(), is(topLimit.limit()));
33023300
var condition = as(source.query(), SpatialRelatesQuery.ShapeQueryBuilder.class);
33033301
assertThat("Geometry field name", condition.fieldName(), equalTo("location"));
33043302
assertThat("Spatial relationship", condition.relation(), equalTo(ShapeRelation.INTERSECTS));

0 commit comments

Comments
 (0)