Skip to content

[AURON #2497] Fix SortExec projected schema and sort key mapping - #2498

Merged
slfan1989 merged 2 commits into
apache:masterfrom
lyne7-sc:fix/sort-exec-projection-sort-key
Sep 5, 2026
Merged

[AURON #2497] Fix SortExec projected schema and sort key mapping#2498
slfan1989 merged 2 commits into
apache:masterfrom
lyne7-sc:fix/sort-exec-projection-sort-key

Conversation

@lyne7-sc

@lyne7-sc lyne7-sc commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

Which issue does this PR close?

Closes #2497

Rationale for this change

SortExec used the full input schema during projected execution and consumed original sort-key indices against the projected schema. Subset or reordered projections could therefore produce an incorrect schema or incorrectly mapped columns.

What changes are included in this PR?

  • Use the projected output schema in both projected execution paths.
  • Remap sort-key indices against every matching position in the projection.
  • Add regression tests for reordered SortMergeJoin projections and strict single-column SortExec projections.

Are there any user-facing changes?

No API changes. Affected projected sort and sort-merge join plans now return columns with the correct schema

How was this patch tested?

Passed unit tests

Was this patch authored or co-authored using generative AI tooling?

  • Yes
  • No

If yes, include: Generated-by: gpt5

ASF guidance: https://www.apache.org/legal/generative-tooling.html

@github-actions github-actions Bot added the native label Sep 1, 2026
@slfan1989 slfan1989 self-assigned this Sep 1, 2026

@slfan1989 slfan1989 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for fixing the projected SortExec schema and sort-key mapping.

Using the projected schema for both execution paths and remapping the original sort-key indices to their projected positions correctly handles subset and reordered projections.

The new direct SortExec and SortMergeJoinExec regression tests cover the affected paths well.

LGTM.

@slfan1989
slfan1989 merged commit 04eeb90 into apache:master Sep 5, 2026
134 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Incorrect SortExec schema and column mapping after projection

2 participants