Skip to content

chore: backport pr 5634 to release/v0.12-internal#8017

Draft
fengys1996 wants to merge 1 commit intoGreptimeTeam:release/v0.12-internalfrom
fengys1996:backport/release-0.12-internal/pr-5634
Draft

chore: backport pr 5634 to release/v0.12-internal#8017
fengys1996 wants to merge 1 commit intoGreptimeTeam:release/v0.12-internalfrom
fengys1996:backport/release-0.12-internal/pr-5634

Conversation

@fengys1996
Copy link
Copy Markdown
Contributor

I hereby agree to the terms of the GreptimeDB CLA.

Refer to a related PR or issue link (optional)

What's changed and what's your intention?

PR Checklist

Please convert it to a draft if some of the following conditions are not met.

  • I have written the necessary rustdoc comments.
  • I have added the necessary unit tests and integration tests.
  • This PR requires documentation updates.
  • API changes are backward compatible.
  • Schema or data changes are backward compatible.

…GreptimeTeam#5634)

* fix: other col alias to time index column handle

* test: update sqlness

* chore: per review

* test: more sqlness

* test: mv some to optimizer folder

* fix: resolve alias properly

* fix: also retain old name

* chore: remove wrong comment

* chore: fix sqlness

* test: standalone/dist more projection diff
@github-actions github-actions Bot added size/M docs-not-required This change does not impact docs. labels Apr 22, 2026
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request enhances the windowed sort optimizer to correctly handle aliased sort expressions by introducing a mechanism to resolve column aliases for the time index during plan traversal. The feedback identifies several critical improvements: the alias_map should be local to each projection to prevent $O(N^2)$ complexity and shadowing bugs, and the resolve_alias logic should be simplified to only include columns explicitly projected. Additionally, the unit tests need to be updated to reflect these logic corrections.

Comment thread src/query/src/optimizer/windowed_sort.rs
Comment thread src/query/src/optimizer/windowed_sort.rs
Comment thread src/query/src/optimizer/windowed_sort.rs
Comment thread src/query/src/optimizer/windowed_sort.rs
@fengys1996 fengys1996 requested a review from discord9 April 22, 2026 09:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs-not-required This change does not impact docs. size/M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants