Skip to content

Commit

Permalink
Fix failing tests after PR clash (elastic#114625)
Browse files Browse the repository at this point in the history
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:
  * elastic#112938
  * merged 14:13CET
* PR that changed the behaviour of these tests:
  * elastic#114411
  * merged 14:48CET
  • Loading branch information
craigtaverner authored Oct 14, 2024
1 parent 2f09fb6 commit 4ab2e61
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 36 deletions.
6 changes: 0 additions & 6 deletions muted-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -363,12 +363,6 @@ tests:
- class: org.elasticsearch.backwards.MixedClusterClientYamlTestSuiteIT
method: test {p0=synonyms/60_synonym_rule_get/Synonym rule not found}
issue: https://github.com/elastic/elasticsearch/issues/114444
- class: org.elasticsearch.xpack.esql.optimizer.PhysicalPlanOptimizerTests
method: testPushSpatialIntersectsEvalToSource {default}
issue: https://github.com/elastic/elasticsearch/issues/114627
- class: org.elasticsearch.xpack.esql.optimizer.PhysicalPlanOptimizerTests
method: testPushWhereEvalToSource {default}
issue: https://github.com/elastic/elasticsearch/issues/114628
- class: org.elasticsearch.xpack.inference.integration.ModelRegistryIT
method: testGetModel
issue: https://github.com/elastic/elasticsearch/issues/114657
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3211,28 +3211,28 @@ public void testPushSpatialIntersectsStringToSource() {
/**
* Plan:
* <code>
* LimitExec[1000[INTEGER]]
* \_ExchangeExec[[],false]
* \_FragmentExec[filter=null, estimatedRowSize=0, reducer=[], fragment=[
* EvalExec[[scalerank{f}#8 AS rank]]
* \_LimitExec[1000[INTEGER]]
* \_ExchangeExec[[],false]
* \_FragmentExec[filter=null, estimatedRowSize=0, reducer=[], fragment=[
* Limit[1000[INTEGER]]
* \_Filter[rank{r}#4 lt 4[INTEGER]]
* \_Eval[[scalerank{f}#8 AS rank]]
* \_EsRelation[airports][abbrev{f}#6, city{f}#12, city_location{f}#13, count..]]]
* \_Filter[scalerank{f}#8 &lt; 4[INTEGER]]
* \_EsRelation[airports][abbrev{f}#6, city{f}#12, city_location{f}#13, count..]]]
* </code>
* Optimized:
* <code>
* LimitExec[1000[INTEGER]]
* \_ExchangeExec[[abbrev{f}#6, city{f}#12, city_location{f}#13, country{f}#11, location{f}#10, name{f}#7, scalerank{f}#8,
* type{f}#9, rank{r}#4],false]
* \_ProjectExec[[abbrev{f}#6, city{f}#12, city_location{f}#13, country{f}#11, location{f}#10, name{f}#7, scalerank{f}#8,
* type{f}#9, rank{r}#4]]
* \_FieldExtractExec[abbrev{f}#6, city{f}#12, city_location{f}#13, count..][]
* \_LimitExec[1000[INTEGER]]
* \_EvalExec[[scalerank{f}#8 AS rank]]
* \_FieldExtractExec[scalerank{f}#8][]
* \_EsQueryExec[airports], indexMode[standard], query[{"
* esql_single_value":{"field":"scalerank","next":{"range":{"scalerank":{"lt":4,"boost":1.0}}},"source":"rank &lt; 4@3:9"}
* }][_doc{f}#23], limit[], sort[] estimatedRowSize[304]
* EvalExec[[scalerank{f}#8 AS rank]]
* \_LimitExec[1000[INTEGER]]
* \_ExchangeExec[[abbrev{f}#6, city{f}#12, city_location{f}#13, country{f}#11, location{f}#10, name{f}#7, scalerank{f}#8,
* type{f}#9],false
* ]
* \_ProjectExec[[abbrev{f}#6, city{f}#12, city_location{f}#13, country{f}#11, location{f}#10, name{f}#7, scalerank{f}#8,
* type{f}#9]
* ]
* \_FieldExtractExec[abbrev{f}#6, city{f}#12, city_location{f}#13, count..][]
* \_EsQueryExec[airports], indexMode[standard], query[{
* "esql_single_value":{"field":"scalerank","next":{"range":{"scalerank":{"lt":4,"boost":1.0}}},"source":"rank &lt; 4@3:9"}
* ][_doc{f}#23], limit[1000], sort[] estimatedRowSize[304]
* </code>
*/
public void testPushWhereEvalToSource() {
Expand All @@ -3243,24 +3243,23 @@ public void testPushWhereEvalToSource() {
""";

var plan = this.physicalPlan(query, airports);
var limit = as(plan, LimitExec.class);
var eval = as(plan, EvalExec.class);
var limit = as(eval.child(), LimitExec.class);
var exchange = as(limit.child(), ExchangeExec.class);
var fragment = as(exchange.child(), FragmentExec.class);
var limit2 = as(fragment.fragment(), Limit.class);
var filter = as(limit2.child(), Filter.class);
assertThat("filter contains LessThan", filter.condition(), instanceOf(LessThan.class));

var optimized = optimizedPlan(plan);
var topLimit = as(optimized, LimitExec.class);
eval = as(optimized, EvalExec.class);
var topLimit = as(eval.child(), LimitExec.class);
exchange = as(topLimit.child(), ExchangeExec.class);
var project = as(exchange.child(), ProjectExec.class);
var fieldExtract = as(project.child(), FieldExtractExec.class);
assertThat(fieldExtract.attributesToExtract().size(), greaterThan(5));
limit = as(fieldExtract.child(), LimitExec.class);
var eval = as(limit.child(), EvalExec.class);
fieldExtract = as(eval.child(), FieldExtractExec.class);
assertThat(fieldExtract.attributesToExtract().stream().map(Attribute::name).collect(Collectors.toList()), contains("scalerank"));
var source = source(fieldExtract.child());
assertThat(source.limit(), is(topLimit.limit()));
var condition = as(source.query(), SingleValueQuery.Builder.class);
assertThat("Expected predicate to be passed to Lucene query", condition.source().text(), equalTo("rank < 4"));
assertThat("Expected field to be passed to Lucene query", condition.field(), equalTo("scalerank"));
Expand All @@ -3281,24 +3280,23 @@ public void testPushSpatialIntersectsEvalToSource() {
""" }) {

var plan = this.physicalPlan(query, airports);
var limit = as(plan, LimitExec.class);
var eval = as(plan, EvalExec.class);
var limit = as(eval.child(), LimitExec.class);
var exchange = as(limit.child(), ExchangeExec.class);
var fragment = as(exchange.child(), FragmentExec.class);
var limit2 = as(fragment.fragment(), Limit.class);
var filter = as(limit2.child(), Filter.class);
assertThat("filter contains ST_INTERSECTS", filter.condition(), instanceOf(SpatialIntersects.class));

var optimized = optimizedPlan(plan);
var topLimit = as(optimized, LimitExec.class);
eval = as(optimized, EvalExec.class);
var topLimit = as(eval.child(), LimitExec.class);
exchange = as(topLimit.child(), ExchangeExec.class);
var project = as(exchange.child(), ProjectExec.class);
var fieldExtract = as(project.child(), FieldExtractExec.class);
assertThat(fieldExtract.attributesToExtract().size(), greaterThan(5));
limit = as(fieldExtract.child(), LimitExec.class);
var eval = as(limit.child(), EvalExec.class);
fieldExtract = as(eval.child(), FieldExtractExec.class);
assertThat(fieldExtract.attributesToExtract().stream().map(Attribute::name).collect(Collectors.toList()), contains("location"));
var source = source(fieldExtract.child());
assertThat(source.limit(), is(topLimit.limit()));
var condition = as(source.query(), SpatialRelatesQuery.ShapeQueryBuilder.class);
assertThat("Geometry field name", condition.fieldName(), equalTo("location"));
assertThat("Spatial relationship", condition.relation(), equalTo(ShapeRelation.INTERSECTS));
Expand Down

0 comments on commit 4ab2e61

Please sign in to comment.