kumarUjjawal opened a new pull request, #27123: URL: https://github.com/apache/datafusion/pull/27123
## Which issue does this PR close? Closes #26624. ## Rationale for this change With `prefer_hash_join = false`, a query can fail physical plan validation when a filter makes a computed sort or join key constant. Embedding a projection into the sort-merge join loses the constant property after sorting has already relied on it. ## What changes are included in this PR? Preserve each projected equivalence class's constant metadata. A projected member has the same value as its source member on every row, and projection keeps rows in the same partitions. Its known value and uniform or partition-local status therefore still hold. Outer joins clear constants on the NULL-padded side before projecting their output. Partition merges clear `Heterogeneous` constants. Also preserve scalar-subquery leaves during indirect projection. They read a shared subquery result without depending on the input schema. The arithmetic `ORDER BY` reproduction needs the metadata copy; the scalar-subquery join reproduction needs both changes. ## What is the testing strategy for this PR? SQL cases in `joins.slt` cover arithmetic, `upper()`, left joins, and the scalar-subquery join. A NULL-padded left join checks that matched values sort before the NULL rows. The metadata unit test covers known, unknown, and partition-local constants, dropped arguments, and partition merging. The original SQL cases and metadata test fail before the fix and pass afterward. Validation includes the extended workspace tests, full lint suite, and strict all-features Clippy. ## Are there any user-facing changes? Affected queries plan and execute successfully. No public API changes. Needs a backport to `branch-56` for the 56.0.0 regression tracker (#24461). -- 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]
