Skip to content

Fix node reduction pushdown tests for release tests#139548

Merged
carlosdelest merged 8 commits intoelastic:mainfrom
carlosdelest:tests/fix-release-tests-local-optimizer
Dec 18, 2025
Merged

Fix node reduction pushdown tests for release tests#139548
carlosdelest merged 8 commits intoelastic:mainfrom
carlosdelest:tests/fix-release-tests-local-optimizer

Conversation

@carlosdelest
Copy link
Member

Closes #139490
Closes #139491
Closes #139492
Closes #139493

Node reduction only happens on snapshot builds. Add guard on the corresponding optimization tests so they check they're on snapshot builds.

@carlosdelest carlosdelest added >test Issues or PRs that are addressing/adding tests test-release Trigger CI checks against release build :Analytics/ES|QL AKA ESQL Team:ES|QL v9.3.0 labels Dec 15, 2025
@carlosdelest carlosdelest marked this pull request as ready for review December 16, 2025 10:24
@carlosdelest carlosdelest requested review from a team and alex-spies December 16, 2025 10:24
@elasticsearchmachine elasticsearchmachine added the Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo) label Dec 16, 2025
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-analytical-engine (Team:Analytics)

Copy link
Contributor

@alex-spies alex-spies left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, but maybe we can future-proof the tests for when the reduction gets released.

}

public void testReductionPlanForTopNWithPushedDownFunctions() {
assumeTrue("Reduction is just enabled for snapshot builds", Build.current().isSnapshot());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there no capability that would correspond to this?

Without a capability, we're very likely to forget to update this test later to remove this assumeTrue.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is none AFAIU. We're using query pragmas for node reduction.

Is there an alternative for detecting that?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see the pragma defaults to true. Doesn't it mean it should be active here by default?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we did this before, but I was going to suggest that maybe we could change the snapshot check with a pragma check. Just to have a link between the feature and the test ignore.

The worst part of the "isSnapshot()" is that they're "hard" to find. Meanwhile, with a capability (Or a pragma), it's easier to trackfollowing references.

Of course, if it defaults to true, it wouldn't solve anything

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The pragma defaults to true - but I don't see them being active on release builds.

Happy to include a different check, I'm just not sure on how to do it on a non-fragile way.

Copy link
Contributor

@alex-spies alex-spies Dec 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see the pragma defaults to true. Doesn't it mean it should be active here by default?

++. I think the late materialization in case of topn may still be turned off on snapshot - I thought we had a capability for that but couldn't find it.

@GalLalouche , we discussed that we wanted to disable this on snapshot builds, but I don't recall which mechanism we settled on to achieve this.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@GalLalouche @alex-spies I'd like to move this forward. Should we change the query pragma for a snapshot capability? Something else?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is indeed disabled for snapshot builds: https://github.com/elastic/elasticsearch/blob/main/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/plugin/DataNodeComputeHandler.java#L195. It also depends on the aforementioned pragma, but there is no ad-hoc pragma just for Top N late materialization.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah I see. Should we then change the dependency on snapshot builds for a Capability (enabled on snsapshots for now) so we can check for it on tests then?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I gave it a go in cb6b571 - LMKWYT!

Copy link
Contributor

@alex-spies alex-spies left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @carlosdelest , I think it's easier to track corresponding tests with the new capability.

@GalLalouche , are there other tests that were disable based simply on Build.current().isSnapshot()? If so, can we tie them to the new capability as well?

@GalLalouche
Copy link
Contributor

Thanks @carlosdelest , I think it's easier to track corresponding tests with the new capability.

@GalLalouche , are there other tests that were disable based simply on Build.current().isSnapshot()? If so, can we tie them to the new capability as well?

@alex-spies @carlosdelest There's EsqlReductionLateMaterializationTestCase, but I don't see where it explicitly depends on the isSnapshot. Can't hurt that add it there though.

@carlosdelest
Copy link
Member Author

@alex-spies @carlosdelest There's EsqlReductionLateMaterializationTestCase, but I don't see where it explicitly depends on the isSnapshot. Can't hurt that add it there though.

Nice, done in 8c90d18.

@carlosdelest carlosdelest enabled auto-merge (squash) December 18, 2025 14:21
@carlosdelest carlosdelest merged commit c8652be into elastic:main Dec 18, 2025
34 of 37 checks passed
szybia added a commit to szybia/elasticsearch that referenced this pull request Dec 19, 2025
* upstream/main: (253 commits)
  Adds ST_SIMPLIFY geo spatial function (elastic#136309)
  Take control of max clause count verification in Lucene searcher (elastic#139752)
  [ML] Unmute Inference Test (elastic#139765)
  Parameterize the vector operation benchmark tests (elastic#139735)
  Fix node reduction pushdown tests for release tests (elastic#139548)
  Fix flakiness in TSDataGenerationHelper (elastic#139759)
  CPS: Copy existing resolved index expressions when constructing a new `SearchRequest` from an existing one (elastic#139596)
  Add release notes for v9.1.9 release (elastic#139674)
  Add lucene query for wildcards on high cardinality keyword fields. (elastic#139746)
  Suppress Tika entitlement warnings from AWT (elastic#139711)
  Check field storage when synthetic source is enabled, in tests (elastic#139715)
  Refactor VectorSimilarityType to know about its corresponding Function (elastic#139678)
  Merge fixes from patch branch back into main (elastic#139721)
  Define native bulk operations for vector square distance (elastic#139198)
  Use LongUpDownCounter for Linked Project Error Metrics (elastic#139657)
  ESQL: Add javadoc that explains version-aware planning (elastic#139706)
  Add helper to pick node for reindex relocation (elastic#139081)
  Fix auth serialization randomized version test (elastic#139182)
  ES|QL - Add parsing, preanalysis and analysis timing information to profile (elastic#139540)
  Mute org.elasticsearch.persistent.ClusterPersistentTasksCustomMetadataTests testMinVersionSerialization elastic#139741
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

:Analytics/ES|QL AKA ESQL Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo) Team:ES|QL >test Issues or PRs that are addressing/adding tests test-release Trigger CI checks against release build v9.4.0

Projects

None yet

5 participants