-
Notifications
You must be signed in to change notification settings - Fork 25.5k
Fix InternalCategorizationAggregationTests.testReduceRandom #135533
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
jan-elastic
merged 1 commit into
elastic:main
from
jan-elastic:fix-InternalCategorizationAggregationTests-testReduceRandom
Sep 29, 2025
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The failing test had a low similarity threshold and two categories that had a matching 3-letter word. This caused these categories to be merged, leading to unexpected results.
With a higher threshold (which is more realistic anyway), this should not happen anymore.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this mean that the test expects that no categories should ever be merged? If so, this assumption makes the test a little weak, since if none of the aggregations that are being reduced actually do anything, we can't really tell if they're being reduced correctly. For example, I could imagine a bug where instead of correctly combining the aggregators, each just overwrites the previous one, and this test would not be able to detect that, because all of the aggregators have the same behaviour of doing nothing.
It might be difficult to produce a deterministic test case where some of the aggregations actually do combine categories without needing to effectively reimplement the aggregation logic in the test, but as it stands, I'm not sure if this test is actually providing much meaningful coverage.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All of that is tested in the different other tests in this package.
This test doesn't provide much coverage for categorize text anyway, because random strings generally lead to categories with one string each.
The problem is that the categorize text agg is special, in the sense that it merges / changes keys in the reduce step. No other agg does that (afaik), and the framework isn't compatible with it. In this way, at least some basic properties are verified.