Support count(eval) expression with stats command#4103
Merged
vamsimanohar merged 8 commits intoopensearch-project:mainfrom Aug 28, 2025
Merged
Support count(eval) expression with stats command#4103vamsimanohar merged 8 commits intoopensearch-project:mainfrom
count(eval) expression with stats command#4103vamsimanohar merged 8 commits intoopensearch-project:mainfrom
Conversation
Signed-off-by: Chen Dai <daichen@amazon.com>
Signed-off-by: Chen Dai <daichen@amazon.com>
Signed-off-by: Chen Dai <daichen@amazon.com>
Signed-off-by: Chen Dai <daichen@amazon.com>
Signed-off-by: Chen Dai <daichen@amazon.com>
Signed-off-by: Chen Dai <daichen@amazon.com>
penghuo
previously approved these changes
Aug 22, 2025
Collaborator
penghuo
left a comment
There was a problem hiding this comment.
Current solution push down count(eval(p)) as script expression? we plan to agg-filter push down in future PR?
Collaborator
Author
I think filtered aggregation pushdown is reverted in PR #4002. I'm working on a follow up PR to reenable it correctly. |
RyanL1997
approved these changes
Aug 25, 2025
ppl/src/main/java/org/opensearch/sql/ppl/parser/AstExpressionBuilder.java
Show resolved
Hide resolved
Signed-off-by: Chen Dai <daichen@amazon.com>
Signed-off-by: Chen Dai <daichen@amazon.com>
ahkcs
approved these changes
Aug 28, 2025
RyanL1997
approved these changes
Aug 28, 2025
penghuo
approved these changes
Aug 28, 2025
ykmr1224
approved these changes
Aug 28, 2025
| * Fluent API for building count(eval) test cases. Provides a clean and readable way to define PPL | ||
| * queries and their expected outcomes. | ||
| */ | ||
| protected PPLQueryTestBuilder withPPLQuery(String ppl) { |
vamsimanohar
approved these changes
Aug 28, 2025
Contributor
|
The backport to To backport manually, run these commands in your terminal: # Navigate to the root of your repository
cd $(git rev-parse --show-toplevel)
# Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add ../.worktrees/sql/backport-2.19-dev 2.19-dev
# Navigate to the new working tree
pushd ../.worktrees/sql/backport-2.19-dev
# Create a new branch
git switch --create backport/backport-4103-to-2.19-dev
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 29c8b72148ba9a46de4d16bd4383eca25c520ffd
# Push it to GitHub
git push --set-upstream origin backport/backport-4103-to-2.19-dev
# Go back to the original working tree
popd
# Delete the working tree
git worktree remove ../.worktrees/sql/backport-2.19-devThen, create a pull request where the |
opensearch-trigger-bot bot
pushed a commit
that referenced
this pull request
Aug 28, 2025
* Rewrite count(eval) expression to support filtered counting Signed-off-by: Chen Dai <daichen@amazon.com> * Refactor count eval UTs Signed-off-by: Chen Dai <daichen@amazon.com> * Add count eval ITs Signed-off-by: Chen Dai <daichen@amazon.com> * Add count eval doctest Signed-off-by: Chen Dai <daichen@amazon.com> * Fix doctest failure Signed-off-by: Chen Dai <daichen@amazon.com> * Add more UT for AST builder Signed-off-by: Chen Dai <daichen@amazon.com> * Resolve conflicts and more changes for shortcut c Signed-off-by: Chen Dai <daichen@amazon.com> --------- Signed-off-by: Chen Dai <daichen@amazon.com> (cherry picked from commit 29c8b72) Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
noCharger
pushed a commit
that referenced
this pull request
Aug 28, 2025
8 tasks
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description
This PR introduces support for
count(eval(condition))function in PPLstatscommand which enables filtered counting capability. Pushdown optimization and additional support fordistinct_count(eval)andeventstatscommand (low priority) will be worked on next. Please find more details in issue below: #3949 (comment).Key implementation decisions:
count(eval(...))is rewritten ascount(CASE WHEN ... THEN 1 ELSE NULL END).countaggregation is supported (distinct_countis planned next). Support for other aggregation functions may be added in the future if the semantic is clear.Related Issues
Resolves (partially) #3949
Check List
--signoffor-s.By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.