alamb commented on issue #26624:
URL: https://github.com/apache/datafusion/issues/26624#issuecomment-6616307845

   I reproduced both queries with `datafusion-cli` and confirmed this is a 
regression that is not yet in any release. I marked the issue as a regression.
   
   Results on the release binaries (both queries, with `prefer_hash_join = 
false`):
   
   | Version | Query 1 | Query 2 |
   |---|---|---|
   | 50.3.0 through 55.1.0 | `x=2, a=1` | `x=2, a=2, b=0` |
   | 55.2.0 (reporter) | ok | ok |
   | `main` (57.0.0-dev) | `SanityCheckPlan` | `SanityCheckPlan` |
   
   `git bisect` on `main` points at a different first-bad commit for each query:
   
   - **Query 2** (scalar subquery as join key) first fails at 872df4d8f0, "fix: 
keep join filter columns when pushing a projection below SortMergeJoinExec" 
(#24593, merged 2026-08-26). Its parent returns the right row. That PR made 
expression projections get embedded into `SortMergeJoinExec` (the 
`projection=[...]` on the join node), which is what sends the equivalence 
properties through `EquivalenceGroup::project`. #24517 alone does not trigger 
either query.
   - **Query 1** (`t1.b + 1` as sort key) first fails at b9cea816dd, "fix: 
prevent unsafe integer interval propagation" (#25234, merged 2026-09-18). Its 
parent returns the right row. Before that PR the filter `CAST(b) + 1 = 2` 
narrowed column `b` itself to a constant, so the plan did not depend on the 
constant of the whole expression. After it, only the expression `CAST(b) + 1` 
is known constant, and that is the constant `EquivalenceGroup::project` drops 
when it rebuilds classes with `EquivalenceClass::new`.
   
   So the two gaps in `class.rs` described above look like latent bugs that 
#24593 and #25234 exposed. Since neither commit is in 55.x, this only affects 
`main` and the upcoming 56.0.0.
   


-- 
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]

Reply via email to