Repository navigation
fix(datafusion): normalize signed zero in remaining filters - #9323
lance-gatefixer[bot] wants to merge 4 commits into
Conversation
|
Blocked: The Ready PR is blocked by a flaky linux-arm Check that the lance-gatefixer App cannot rerun. Remote head a4270ba contains the current main tip d073576. Rust workflow run 35160280317, job linux-arm (105009217457), failed only test_legacy_ivf_pq_cosine_multivec_smoke at recall 0.49 versus the 0.50 threshold after 3,894 tests passed; the PR does not change that vector-index path, its KMeans initialization draws an OS-random seed, and focused reruns on this head pass. A failed-job rerun was attempted, but GitHub rejected it because this integration lacks Actions rerun access. The smallest action is for a maintainer to rerun the failed linux-arm job. Alternatively, grant lance-gatefixer Actions write permission and wake this FixAgent so it can request the rerun. |
Support SQL `IS [NOT] DISTINCT FROM` in Lance filters, which previously failed with "not supported SQL". The planner now maps both spellings to DataFusion's `IsDistinctFrom` / `IsNotDistinctFrom`, as DataFusion's own SQL frontend does. Literal coercion, the signed-zero rewrite (`x IS NOT DISTINCT FROM 0.0` matches both zero encodings) and null-safe evaluation already handle these operators. Also fixes the `signed_zero.rs` doc table, which described an outdated rewrite shape. Column-vs-column signed zeros and NaN still follow Arrow's total order (#9316, fixed by #9323; #9315).
There was a problem hiding this comment.
✅ Gate recommendation: approve.
The main-branch merge preserves signed-zero and NULL behavior, including null-safe comparisons and exact DOUBLE-to-Float32 literal coercion. Normalization remains reconstructible through Substrait, while array_has_any preserves a single evaluation of volatile haystacks and the indexed, null, and empty-list cases. I found no remaining material issue in this revision.
Summary
Root cause
The signed-zero optimizer only handled comparisons that contained a zero literal. Column-to-column comparisons therefore reached Arrow total-order kernels unchanged, and array_has probed only the literal bit pattern, so negative and positive zero compared as different values. Expanding array_has into two OR arms would evaluate a volatile haystack twice, so the repair uses a single two-needle probe.
Validation
Validated after merging main at a801db8 with Rust 1.98.1:
cargo fmt --allcargo test -p lance-datafusion --features substrait(278 unit tests and 5 doctests passed)cargo test -p lance --lib --test integration_tests --features substrait,slow_tests signed_zero(codec round-trip and dataset regression passed)cargo clippy --all --tests --benches -- -D warningsFixes #9316