dongjoon-hyun opened a new pull request, #59163: URL: https://github.com/apache/spark/pull/59163
### What changes were proposed in this pull request? This PR aims to make `DataSourceV2ScanExecBase.outputOrdering` keep only the leading sort orders over output columns when a DSv2 source reports an ordering on a column pruned out of the scan output. This is consistent with `DataSourceV2ScanRelation.doCanonicalize`. ### Why are the changes needed? `V2ScanPartitioningAndOrdering` converts the reported ordering against the relation before column pruning, so the ordering can reference pruned columns. A row-based scan is safe because its `ProjectExec` truncates such an ordering, but a columnar scan can reach the k-way merge of `GroupPartitionsExec` without one, and the merge fails. ``` [INTERNAL_ERROR_ATTRIBUTE_NOT_FOUND] Could not find ts#11 in [id#9,data#10]. SQLSTATE: XX000 ``` ### Does this PR introduce _any_ user-facing change? Yes, this fixes a query failure when `spark.sql.sources.v2.bucketing.preserveOrderingOnCoalesce.enabled` (default: `false`, since 4.2.0) is enabled. ### How was this patch tested? Pass the CIs with the newly added test case. ### Was this patch authored or co-authored using generative AI tooling? Generated-by: Claude Opus 5.5 -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
