sunchao commented on PR #58522: URL: https://github.com/apache/spark/pull/58522#issuecomment-5547679944
**Request changes: one P1 correctness issue.** Reviewed all six changed files at `78e2e312f272`. ### [P1] Preserve full partition keys for scan preparation At [DataSourceV2ScanExecBase.scala:108](https://github.com/apache/spark/blob/78e2e312f2729c8b1cae1598a9121177267b0c67/sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/v2/DataSourceV2ScanExecBase.scala#L108), the projection shortens partition-key rows and their types. However, `BatchScanExec.filteredPartitions` passes that projected partitioning into `PushDownUtils.replanWithRuntimeFilters`, which still reads **full source keys**. This has three consequences: - **Wrong results:** pruning a leading or middle key can make the actual partition order disagree with its advertised keys, causing joins to lose rows. - **Type errors:** pruning a leading string key while retaining an integer key makes the sorter read a string as an integer. - **Runtime-filtering failures, even with trailing pruning:** hashing iterates over the full key’s fields but indexes the shorter projected type array, causing `ArrayIndexOutOfBoundsException` when partitions survive filtering. Keep the full source-key layout for input sorting and runtime filtering; expose the projected partitioning downstream. Add tests for leading/middle pruning and runtime filtering with surviving partitions. This confirms the [existing review’s diagnosis](https://github.com/apache/spark/pull/58522#discussion_r3933688559) and extends its runtime-filtering impact. I found no additional actionable canonicalization/equality issues. **Validation:** source tracing and an executable model reproduced the ordering mismatch and schema-index failure. Full Spark tests were not run; the checkout lacks the required build dependencies. -- 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]
