Skip to content

Introduce partitioning in TopN operator #128135

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

Draft
wants to merge 234 commits into
base: main
Choose a base branch
from

Conversation

przemekwitek
Copy link
Contributor

@przemekwitek przemekwitek commented May 19, 2025

This PR introduces the ability to use TopN operator together with a collection of given partition fields in order to respond to "Give me top N results per partition field P" queries.
Example:
"Give me the last 10 trade orders per stock ticker"

This functionality will be needed in order to implement `CHANGE_POINT ... BY ..." in the subsequent PRs.

@przemekwitek przemekwitek force-pushed the topn_partition branch 3 times, most recently from a5b4f15 to 2db7dab Compare May 20, 2025 08:25
@przemekwitek przemekwitek changed the title Introduce grouping in TopN operator Introduce partitioning in TopN operator May 20, 2025
@astefan astefan requested a review from nik9000 May 20, 2025 09:10
github-actions bot and others added 19 commits May 20, 2025 11:15
Made with ❤️️ by updatecli

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
…vice (elastic#128119)

SharedBlobCacheService keeps track of the free regions in a
ConcurrentLinkedQueue. We use its "size()" method in three places
outside of tests but unfortunately this is not a constant time operation
because of the asynchronous nature of this queue. This change removes
two of the uses where we only check if the queue is empty by calling the
"isEmpty()" method instead.
…c#127371)

Replaces the use of a SingleResultDeduplicator by refactoring the cache as a
subclass of CancellableSingleObjectCache. Refactored the AllocationStatsService
and NodeAllocationStatsAndWeightsCalculator to accept the Runnable used to test
for cancellation.

Closes elastic#123248
Ensure sufficent bytes for the start position.
* Disallow removal of regex extracted fields
---------

Co-authored-by: Andrei Stefan <[email protected]>
Co-authored-by: elasticsearchmachine <[email protected]>
The Replace string result limit was fixed to 1MB, same as Repeat
When the Transform System Index has been reindexed and aliased, we
should check the Transform Update index against the alias when updating
the Transform Config.
In order to remove ActionType, ActionRequest will become strongly typed,
referring to the ActionResponse type. As a precursor to that, this
commit adds a LegacyActionRequest which all existing ActionRequest
implementations now inherit from. This will allow adding the
ActionResponse type to ActionRequest in a future commit without
modifying every implementation at once.
* Replace irregular whitespaces

* More chars
* Fail fast on invalid entitlement patches

* Don't peel off `PolicyParserException`

* Just catch Exception
prdoyle and others added 27 commits May 30, 2025 17:05
* Rename and encapsulate InitializeArgs

* Move ElasticsearchEntitlementChecker out of api package.

It's an implementation detail that doesn't need to be exposed to the rest of
the system.

* Stub TestPathLookup (not yet implemented)
Entitlement instrumentation works by reflectively calling back into the
entitlements lib to grab the checker. It must be fully in place before
any classes are instrumented. This commit fixes a bug that was
introduced by refactoring which caused the checker to not be set until
after all classes were instrumented. In some situations this could lead
the checker to being null when it is grab (and statically cached) by the
entitlement bridge.
…LikeTests testEvaluateInManyThreads {TestCase=100 random code points matches self case insensitive with text} elastic#128705
…LikeTests testEvaluateInManyThreads {TestCase=100 random code points matches self case insensitive with keyword} elastic#128706
…LikeTests testCrankyEvaluateBlockWithNulls {TestCase=100 random code points matches self case insensitive with text} elastic#128710
…LikeTests testCrankyEvaluateBlockWithNulls {TestCase=100 random code points matches self case insensitive with keyword} elastic#128711
…ildcardLikeTests testCrankyEvaluateBlockWithNulls {TestCase=100 random code points matches self case insensitive with text} elastic#128712
…ildcardLikeTests testCrankyEvaluateBlockWithNulls {TestCase=100 random code points matches self case insensitive with keyword} elastic#128713
…ildcardLikeTests testEvaluateBlockWithNulls {TestCase=100 random code points matches self case insensitive with text} elastic#128714
…ildcardLikeTests testEvaluateBlockWithNulls {TestCase=100 random code points matches self case insensitive with keyword} elastic#128715
…LikeTests testEvaluateBlockWithNulls {TestCase=100 random code points matches self case insensitive with keyword} elastic#128716
…LikeTests testEvaluateBlockWithNulls {TestCase=100 random code points matches self case insensitive with text} elastic#128717
More robust test for closed clients holder. Also changes
IllegalStateException to AlreadyClosedException for both closed manager
and holder.

Resolves: elastic#128707
…stic#128650)

If an index is deleted after a snapshot has written its shardGenerations 
file but before the snapshot is finalized, we exclude this index from the 
snapshot because its indexMetadata is no longer available. However, 
the shardGenerations file is still valid in that it is the latest copy with all 
necessary information despite it containing an extra snapshot entry. 
This is OK. Instead of dropping this shardGenerations file, this PR 
changes to carry it forward by updating RepositoryData and relevant 
in-progress snapshots so that the next finalization builds on top of this one.

Co-authored-by: David Turner <[email protected]>
…lastic#128362)

Starting with Lucene 10, `CharacterRunAutomaton` is no longer determinized automatically.
In Elasticsearch 9, we adapted to this by eagerly determinizing automatons early (via `Regex#simpleMatchToAutomaton`).
However, this introduced  regression: operations like index template conflict checks, which only require intersection testing, now pay the cost of determinization—an expensive step that wasn’t needed before. In some cases, especially when many wildcard patterns are involved, determinization can even fail due to state explosion.

This change removes the unnecessary determinization, restoring the pre-9.0 behavior and allowing valid index templates with many patterns to be registered again.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.