alamb commented on issue #26779: URL: https://github.com/apache/datafusion/issues/26779#issuecomment-6481178144
I bisected this. Two PRs fixed it, both from @haohuaijin and both merged after 55.2.0, so the fix will first ship in 56.0.0: - #25234 (`fix: prevent unsafe integer interval propagation`, merged 2026-09-18) fixes the integer division shapes (`k / 10 = 5`, `IN`, `BETWEEN`, `>= AND <=`, `k / 10 = j AND j = 5`). Inverse propagation through `/` used to narrow `k` to the single point `[50, 50]`; it is now skipped for integer division and for arithmetic that may wrap. - #25531 (`fix: restrict reverse cast constraint propagation to safe conversions`, merged 2026-09-20) fixes the `CAST(ts AS DATE) = DATE '...'` shape. Casting the singleton date interval back to timestamp used to yield a single point; reverse propagation is now limited to an allowlist of lossless casts. Verified with `datafusion-cli` built at the parent of #25234, at #25234, and at #25531, using the table from the report (`k = (v*7) % 120`, `id = v`, 400 rows): | Commit | `WHERE k / 10 = 5 ORDER BY k, id` | `WHERE CAST(ts AS DATE) = DATE '2024-01-06' ORDER BY ts, id` | |---|---|---| | 3a647e49dd (before #25234) | `SortExec: expr=[id@1 ASC NULLS LAST]`, rows come back as 56, 55, 54, 53, ... | `SortExec: expr=[id@1 ASC NULLS LAST]` | | b9cea816dd (#25234) | `SortExec: expr=[k@0 ASC NULLS LAST, id@1 ASC NULLS LAST]`, rows sorted | `SortExec: expr=[id@1 ASC NULLS LAST]` (still wrong) | | 4e603e15d9 (#25531) | same, sorted | `SortExec: expr=[ts@0 ASC NULLS LAST, id@1 ASC NULLS LAST]`, rows sorted | Both PRs already added regression tests for these exact shapes: `a / 2::INT = 1::INT ORDER BY a DESC` in `filter_without_sort_exec.slt` and `CAST(t AS DATE) = DATE '2026-01-01' ORDER BY t DESC` in `cast.slt`. So I think this can be closed as fixed by #25234 and #25531. -- 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]
