jayzhan211 opened a new pull request, #24519:
URL: https://github.com/apache/datafusion/pull/24519
## Rationale for this change
ASOF joins currently convert both match values into `ScalarValue`s for
row-level
comparisons. This adds repeated scalar construction and type dispatch to the
ordered scan hot path.
The match expressions are already evaluated into Arrow arrays for each input
batch, so the join can compare array positions directly using an Arrow
comparator constructed once per left/right batch pair.
## What changes are included in this PR?
- Compare ASOF match keys directly from their evaluated Arrow arrays.
- Cache the match comparator for each left/right batch pair.
- Cache logical match-key nulls so NULL checks do not require scalar
materialization.
- Normalize floating-point signed zero once per batch so Arrow comparisons
preserve SQL semantics where `-0.0` and `+0.0` compare equal.
- Document why comparator caching, batch-level normalization, shared Arrow
buffers, and forward-only scanning are important to the hot path.
## Are these changes tested?
Yes.
- Added a regression test verifying that floating-point `-0.0` and `+0.0`
remain equal for ASOF match conditions.
- Existing ASOF tests cover equality groups, NULL handling, batch boundaries,
comparison directions, shared build memory, and expression validation.
The following checks pass:
- `cargo test -p datafusion-physical-plan asof_join --lib`
- `cargo clippy -p datafusion-physical-plan --lib -- -D warnings`
- `cargo fmt --all -- --check`
## Are there any user-facing changes?
No API or query-semantic changes are intended.
This is an internal execution optimization. Floating-point signed-zero and
logical-NULL behavior are explicitly preserved.
--
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]