[FLINK-39221][table] Add AGGREGATE_VALUES rule for constant folding o…#27742
Merged
fapaul merged 1 commit intoapache:masterfrom Mar 6, 2026
Merged
[FLINK-39221][table] Add AGGREGATE_VALUES rule for constant folding o…#27742fapaul merged 1 commit intoapache:masterfrom
fapaul merged 1 commit intoapache:masterfrom
Conversation
Collaborator
twalthr
reviewed
Mar 6, 2026
| // Replaces global Aggregate over empty Values with default literal values | ||
| // (e.g. COUNT(*)=0). Handles the plan-time case where the planner can | ||
| // statically determine the input is empty. | ||
| CoreRules.AGGREGATE_VALUES |
Contributor
There was a problem hiding this comment.
Can we also add this to FlinkBatchRuleSets for unified behavior?
Contributor
Author
There was a problem hiding this comment.
I updated the PR with the batch tests
…f global aggregates Add CoreRules.AGGREGATE_VALUES to PRUNE_EMPTY_RULES so the planner can replace a global aggregate over statically empty input (e.g. WHERE 1=0) with literal default Values at plan time (COUNT(*)=0, SUM=null, etc.), eliminating the GroupAggregate node entirely. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
twalthr
approved these changes
Mar 6, 2026
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.
…f global aggregates
What is the purpose of the change
Add CoreRules.AGGREGATE_VALUES to PRUNE_EMPTY_RULES so the planner can replace a global aggregate over statically empty input (e.g. WHERE 1=0) with literal default Values at plan time (COUNT(*)=0, SUM=null, etc.), eliminating the GroupAggregate node entirely.
Brief change log
Verifying this change
Does this pull request potentially affect one of the following parts:
@Public(Evolving): (yes / no)Documentation