-
Notifications
You must be signed in to change notification settings - Fork 181
Replace duplicated aggregation logic with aggregateWithTrimming()
#4926
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
Conversation
Signed-off-by: Xinyu Hao <[email protected]>
📝 WalkthroughSummary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings. WalkthroughThis change consolidates window-function aggregation logic in the Streamstats command by replacing a duplicate aggregation implementation with a call to the existing Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro 📒 Files selected for processing (10)
🧰 Additional context used📓 Path-based instructions (5)**/*.java📄 CodeRabbit inference engine (.rules/REVIEW_GUIDELINES.md)
Files:
⚙️ CodeRabbit configuration file
Files:
**/calcite/**/*.java⚙️ CodeRabbit configuration file
Files:
**/*Test.java📄 CodeRabbit inference engine (.rules/REVIEW_GUIDELINES.md)
Files:
**/test/**/*.java⚙️ CodeRabbit configuration file
Files:
**/ppl/**/*.java⚙️ CodeRabbit configuration file
Files:
🧠 Learnings (3)📚 Learning: 2025-12-02T17:27:55.938ZApplied to files:
📚 Learning: 2025-12-02T17:27:55.938ZApplied to files:
📚 Learning: 2025-12-02T17:27:55.938ZApplied to files:
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (28)
🔇 Additional comments (11)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ast-grep (0.40.0)core/src/main/java/org/opensearch/sql/calcite/CalciteRelNodeVisitor.java[] Comment |
| List<AggCall> aggCalls = buildAggCallsForWindowFunctions(node.getWindowFunctionList(), context); | ||
| context.relBuilder.aggregate(context.relBuilder.groupKey(), aggCalls); |
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.
@yuancu @songkant-aws we'd better not to call context.relBuilder.aggregate directly, instead, use aggregateWithTrimming to build aggregation in stack. I see some codes in visitChart, rankByColumnSplit and visitPatterns. Can you create a issue to replace?
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.
Or co-auther with @ishaoxy to address them in this PR.
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.
I did so because I needed to build multiple aggregations for the chart command. aggregateWithTrimming works on PPL's AST (composed of UnresolvedPlan) and creates RexNode AST, but I have already gone through this in the first aggregation. Therefore, I had to call relBuilder.aggregate the second time I created an aggregation to aggregate on RexNode.
|
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-4926-to-2.19-dev
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 35ca89e6ea626600393c6c21cbdb7fcea6a07d43
# Push it to GitHub
git push --set-upstream origin backport/backport-4926-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 |
Signed-off-by: Xinyu Hao <[email protected]>
… (#4942) Signed-off-by: Xinyu Hao <[email protected]>
Description
Just use
aggregateWithTrimming()to avoid duplicating existing functionality.Related Issues
Resolves #4925
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.