Repository navigation
refactor(sql): reduce copies of query context in PlannerContext - #20630
Open
FrankChen021 wants to merge 2 commits into
Open
FrankChen021 wants to merge 2 commits into
FrankChen021 wants to merge 2 commits into
Conversation
FrankChen021
commented
Oct 19, 2026
FrankChen021
left a comment
Member
Author
There was a problem hiding this comment.
🟢 Approval recommended
No actionable issues found in this review. The QueryContext override paths preserve sorted-key and null-removal behavior, and all four former planner-map writes now update the immutable context before later query/task construction.
Reviewed 6 of 6 changed files.
Validation: git diff --check 84e88bb46c68c59333f2aa55c343416c628ae1d0 b4ed0c4d73a5c0f9d8b2941008cf6f0085cbf89b passed; no tests or builds were run.
This is an automated review by Codex GPT-5.6-Luna(max)
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
PlannerContextstored the query context as a mutable map, and everyqueryContext()call built a newQueryContext(a sorted copy) from it.queryContext()is called many times during planning.This PR makes
PlannerContexthold a single immutableQueryContextand return it directly:queryContextMap()now returns an immutable snapshot.rowsPerSegment, REPLACE time chunks, export file format) now use the newPlannerContext#setQueryContextParameter, which replaces the context with an overridden copy.QueryContext#override(QueryContextParameter<T>, T). It, and the existingoverride(Map), now copy the context once instead of twice, and still keep keys sorted.PlannerContext#addAllToQueryContext.This PR has: