efegokdemir opened a new pull request, #26031: URL: https://github.com/apache/datafusion/pull/26031
## Which issue does this PR close? - Closes #26029. ## Rationale for this change TopK dynamic filtering can return incorrect rows when one sort expression contains another sort key. Child-first remapping changes the parent before it can be matched. ## What changes are included in this PR? Remap matching parent expressions before their descendants and stop traversing each replacement. Add the reported query as a SQL logic test. ## What is the testing strategy for this PR? - `cargo test --profile=ci --test sqllogictests -- topk_dynamic_filter_remap.slt` - `cargo test --profile=ci -p datafusion-physical-expr --lib` (1685 passed, 2 ignored) - `cargo fmt --all --check` - `cargo clippy --profile ci -p datafusion-physical-expr --lib -- -D warnings` - All-target Clippy passed with `-A clippy::ignore-without-reason` for an existing ignored test lacking a reason in `planner.rs`. The broader `topk.slt` file could not be validated because this shallow checkout does not include the `testing` submodule data. ## Are there any user-facing changes? Yes. Queries matching this case now return the correct TopK rows; there is no API change. -- 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]
