-
Notifications
You must be signed in to change notification settings - Fork 25.8k
ESQL: Adds GroupedTopN command #140019
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
Closed
Closed
ESQL: Adds GroupedTopN command #140019
Changes from all commits
Commits
Show all changes
149 commits
Select commit
Hold shift + click to select a range
bb1ecd3
Wrap with interface, composition over inheritance
GalLalouche 133f1af
more extractions
GalLalouche cd2f369
more extractions
GalLalouche ee765e1
More extractions, some code for Grouped
GalLalouche e1080c7
TEMP
GalLalouche 2a67151
Before cursor
GalLalouche 9a6b49a
cursor test 1
GalLalouche 25691af
some test refactor
GalLalouche ae94d75
Before cursor
GalLalouche 4e2efcf
More refactors and stuff
GalLalouche 41ead05
Before cursor test
GalLalouche 5fdb733
Before cursor
GalLalouche 4fd333d
TEMP
GalLalouche 14d2687
TEMP
GalLalouche c57fb6c
Adds GroupedTopN to the parser and the logical plan
ncordon 3388918
fix tests
GalLalouche cfa5dc5
Before cursor
GalLalouche 788b984
More Before cursor
GalLalouche 23d2c43
Refactor GroupedRow and GroupedRowFiller to include group key handlin…
GalLalouche df7f4d0
Cursor
GalLalouche 0d37ca0
Refactor GroupedRowFiller to support multiple group key extractors an…
GalLalouche cb1475a
Add tests for row eviction and size management in GroupedQueue
GalLalouche 54e8c3e
Add RAM usage tests for GroupedQueue to verify memory consumption in …
GalLalouche eb9a3da
lost in overcounting, trying cursor
GalLalouche dce75b4
Temp
GalLalouche 95ee4c0
Thanks cursor!
GalLalouche 05f5812
Yey
GalLalouche 7224fc0
Small refactors
GalLalouche ad61558
Refactors
GalLalouche 8af289e
refactors
GalLalouche 84b5255
Fix leak
GalLalouche 01546fc
Some more tests, fixed some bugs
GalLalouche d5d06fc
Stuff
GalLalouche 9c4311d
More stuff
GalLalouche de5dfd5
More tests (shard contexts)
GalLalouche b5ed2e8
Uses the 🐔
ncordon 2064816
Large random
GalLalouche e3e9694
Uses a groupings field instead of GroupedTopN separate AST
ncordon ad57526
Merge remote-tracking branch 'upstream/main' into grouped_topn
ncordon 2ea9a5c
Fixes serialization tests
ncordon 0a09abd
Adds groupings to TopNExec
ncordon 190934e
Removes unneccesary new line from antlr file
ncordon d6bbc17
Adds tests for physical and local physical part
ncordon 78e9d36
Merge branch 'main' into feature/grouped_top_n
GalLalouche 0828b18
Merge branch 'feature/grouped_top_n' into grouped_topn
GalLalouche a5f373c
Some small fixes after merge
GalLalouche fd2ae5f
[CI] Auto commit changes from spotless
dad886d
Before agent
GalLalouche 5ca3345
After agent, before another
GalLalouche ef90153
Tests pass!
GalLalouche f854cc2
Refactor
GalLalouche 22025cc
Refactor tests
GalLalouche 14f8c11
Handle group key size preallocation
GalLalouche f4b6d0d
Reuse inheritance
GalLalouche fa4ec5f
Some small clean ups
ncordon f0f11d6
[CI] Auto commit changes from spotless
6255afc
Fix another TODO
GalLalouche d73df48
Replace List with array
GalLalouche 4cd58b4
Merge remote-tracking branch 'upstream/main' into grouped_topn
ncordon ae6c126
Adds transport version gating
ncordon 89addfc
[CI] Update transport version definitions
9a5e3fe
[CI] Update transport version definitions
8668f99
Fixes transport versions and csv test
ncordon 79d710b
Fixes transport versions and csv test, adds a couple more
ncordon 1ae738a
Fixes compilation
ncordon ada3bbe
Adds more tests
ncordon e9f5b3a
Merge remote-tracking branch 'upstream/main' into grouped_topn
ncordon d0ccc61
Test fix
GalLalouche 73dfb22
Test refactoring
GalLalouche 7978408
Slightly less ugly memory releasing
GalLalouche eea2f7c
More test refactors, mostly around RAM usages
GalLalouche 9bbdcfb
Remove TODOs and other misc.
GalLalouche 5d9f099
Fixes serialization
ncordon f28bcf8
Adds more tests
ncordon 43e7f50
Fixes local physical plan test
ncordon 529572d
Fixes tests (hopefully)
ncordon 72fa42f
Adds some golden tests
ncordon 6bf4061
Merge remote-tracking branch 'upstream/main' into grouped_topn
ncordon bd91a2d
This golden test seems flaky in how the output is formatted
ncordon 1f1a503
Fixes another serialization that is failing
ncordon c0e2f85
Merge remote-tracking branch 'upstream/main' into grouped_topn
ncordon 8accc92
Merge commit 'b27c97b8f1c28749678b4c7ebb47c93b8d453a86' into grouped_…
ivancea 5de5f0e
Merge commit 'acd9e98' into grouped_topn
ivancea d20e37e
Fix GroupedTopNOperatorTests
ivancea 8009667
Merge branch 'main' into grouped_topn
ivancea 23c8caf
Merge branch 'main' into grouped_topn
ivancea 0302dc7
Fixes more merge conflicts
ncordon 1d11414
Merge branch 'main' into grouped_topn
ncordon 4288248
Updated golden tests
ivancea b786a67
Rename LIMIT PER to LIMIT BY
ivancea c7efa7c
Added tests without an extra sort at the end
ivancea e253371
Fix bug in grouped topN when short-circuiting condition is true
ivancea dfeb094
Adds ReplaceLimitByExpressionWithEval
ncordon 9628e57
Adds more tests
ncordon 006c41f
Temp
ncordon 9a4d7a8
Addresses the case where we have a constant grouping
ncordon dbdc34e
Merge remote-tracking branch 'upstream/main' into grouped_topn
ncordon ee6ab54
Add new test cases for sort_by_limit capability in topN.csv-spec
ncordon 9b26b43
Merge remote-tracking branch 'upstream/main' into grouped_topn
ncordon 04e4f43
Fixes compilation
ncordon 58b4793
Merge remote-tracking branch 'upstream/main' into grouped_topn
ncordon 63e0e16
Fixes more compilation errors
ncordon 3979759
Adds golden tests
ncordon e69566d
Small nit
ncordon e7a7291
Migrated HashMap to BlockHash in Grouped TopN
ivancea ac43fc8
Remove extra0 files
ivancea 859d8f4
Fixed ToString tests
ivancea 4687029
[CI] Auto commit changes from spotless
e8f3590
Fixed multivalue behaviour to reproduce that of stats by
ivancea 4c5bbba
Merge branch 'main' into grouped_topn
ivancea fc92e54
Multivalue fix for pages with many groups
ivancea 44688a8
Merge branch 'main' into grouped_topn
ivancea b6ddcf8
[CI] Auto commit changes from spotless
b3e4ea2
Merge branch 'main' into grouped_topn
ivancea 3d7dc08
Merge branch 'main' into grouped_topn
ivancea 1985436
Format
ivancea 1ef812b
Fixed multivalue propagation through LIMIT BY groupings
ivancea 06e20c5
Separated TopNOperator into TopN and GroupedTopN operators
ivancea d7c20bf
Added logical plan tests for multivalues
ivancea 06586c2
Enables LIMIT BY
ncordon aec8a15
Adds tests for limit by
ncordon 0799d95
Fixes bug with LIMIT pushed past EVAL
ncordon 12aa13f
Simplifies check in PushDownAndCombineLimits
ncordon 0a39dac
Removes non needed capability
ncordon 030f24d
Add memory accounting test to Grouped too
ivancea 5917fc5
Merge branch 'grouped-topn-separated-operators' into grouped_topn
ivancea eee3368
Small nits
ncordon 67de1b8
Uses BytesRefHashTable instead of Map
ncordon 0e51868
Merge remote-tracking branch 'upstream/main' into grouped_topn
ncordon 1e8c873
Merge branch 'main' into grouped_topn
ivancea 7f39325
Reduce duplicated test code
ivancea 2ea23c0
Updated multivalues handling to treat them as lists, and update plans…
ivancea 20b6005
Make groups longs
ivancea 88aa079
Merge branch 'main' into grouped_topn
ivancea 84b24ce
Added separated operator status for grouped
ivancea 0034e99
[CI] Auto commit changes from spotless
4fb118b
Add default limits ignoring LIMIT BY
ivancea b3bd9aa
Merge branch 'main' into grouped_topn
ivancea 2d4bfe6
Updated GoldenTests and added LimitBy without sort test
ivancea cbe8a51
Changed equals to semanticEquals and added tests for it
ivancea 2e85d86
Fix compilation issue and checkstyle
ivancea b835488
Merge remote-tracking branch 'upstream/main' into grouped_topn
ncordon a6a6a36
Avoids pushing the LimitExec to source when there are groupings
ncordon 0bfda27
Merge branch 'main' into grouped_topn
ivancea 58a6fe6
Remove post-merge remains
ivancea a495c36
Merge branch 'main' into grouped_topn
ivancea cfa4cb8
Merge branch 'main' into grouped_topn
ivancea 82792cb
Remove LIMIT BY verifier check
ivancea d3286a4
[CI] Auto commit changes from spotless
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| pr: 140019 | ||
| summary: Adds `GroupedTopN` ESQL parsing and planning | ||
| area: ES|QL | ||
| type: feature | ||
| issues: [] |
1 change: 1 addition & 0 deletions
1
server/src/main/resources/transport/definitions/referable/esql_limit_by.csv
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| 9314000 |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1 @@ | ||
| sql_optional_allow_partial_search_results,9313000 | ||
| esql_limit_by,9314000 |
976 changes: 976 additions & 0 deletions
976
x-pack/plugin/esql/qa/testFixtures/src/main/resources/topN.csv-spec
Large diffs are not rendered by default.
Oops, something went wrong.
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
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
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
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
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
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
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
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
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
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.
Not true anymore, we need to change this