[FLINK-39268][table] Expand and reuse local refs in CalcCodeGenerator#28113
Open
snuyanzin wants to merge 5 commits intoapache:masterfrom
Open
[FLINK-39268][table] Expand and reuse local refs in CalcCodeGenerator#28113snuyanzin wants to merge 5 commits intoapache:masterfrom
CalcCodeGenerator#28113snuyanzin wants to merge 5 commits intoapache:masterfrom
Conversation
twalthr
reviewed
May 5, 2026
Contributor
twalthr
left a comment
There was a problem hiding this comment.
Thanks for the PR @snuyanzin. This will improve all Flink SQL pipelines significantly. I added some feedback around code readability and maintenance.
| "[{\"k\":\"V\"}]", | ||
| STRING().notNull(), | ||
| STRING().notNull())), | ||
| // Shared JSON(f) inside two JSON_ARRAY projections. |
Contributor
There was a problem hiding this comment.
inside two JSON_ARRAY projections
I see only one projection. I guess you are assuming two due to internals of the test base that combines Table API and SQL into one? Maybe it makes sense to have a test that fully uses SQL to explicitly test two JSON_ARRAY projections
| /** | ||
| * Pins the CASE-WHEN guard interaction with the RexLocalRef cache. | ||
| * | ||
| * <p>Prior to scoped caching, RexProgramBuilder collapsed the division {@code a / b} into a |
Contributor
There was a problem hiding this comment.
Prior to scoped caching,
Please instruct AI to not use temporal references. Something like:
- Add comments that are useful for long-term maintenance of the code base. Avoid obvious JavaDocs, obvious parameter or return type descriptions. Don't include short-term comments that have been directly derived from the prompt such as "now uses" or "now works differently" or historical references like "previously", those rather distract a reader who is new to the code base.
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.
What is the purpose of the change
The PR makes local refs expandable and reusable (so far projections and filters)
Also since for some operators like
AND,OR,CASE,COALESCEthere might be short circuitsit introduces scope
also deterministic/non-deterministic functions are taken into account
Brief change log
code gen
Verifying this change
existing tests and a number of added tests
Does this pull request potentially affect one of the following parts:
@Public(Evolving): ( no)Documentation
Was generative AI tooling used to co-author this PR?