You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@datafusion.apache.org by "geoffreyclaude (via GitHub)" <gi...@apache.org> on 2026/09/30 16:35:19 UTC
[PR] perf: optimize dictionary float-zero normalization [datafusion]
geoffreyclaude opened a new pull request, #25912:
URL: https://github.com/apache/datafusion/pull/25912
Stacked on #25186. Review the [optimization-only diff](https://github.com/apache/datafusion/compare/ba584cd25592c7868402ef48e0b3646bb143e6ea..e1bd187acd4b57cb291a4f66f2767daf045d80af). This is a draft until the parent merges; the GitHub diff against `main` currently also includes the parent's functional changes.
## Which issue does this PR close?
None.
## Rationale for this change
Dynamic `IN` evaluation over dictionary-encoded floats can spend unnecessary time revalidating unchanged dictionary keys during signed-zero normalization. The existing generic `has_float_leaf` path already normalizes dictionary arrays correctly; this PR specializes that path to reduce its overhead while preserving results.
## What changes are included in this PR?
- Reuses dictionary keys when normalized values change, avoiding dictionary `ArrayData` reconstruction and key validation.
- Drops redundant all-valid bitmaps from rewritten values so comparisons can reuse key validity without scanning every key for value nulls.
- Adds a focused four-case benchmark in a separate commit before the optimization.
## What is the testing strategy for this PR?
The existing dictionary regression checks normalized zeros, preserved keys and NaN payloads, scalar consistency, and idempotence. It now also checks that rewriting all-valid values removes redundant validity and lets logical nulls reuse the keys' bitmap. The benchmark verifies expected results outside the timed evaluation.
Benchmark commit f48613118b uses the generic normalization path. The immediately following commit, e1bd187acd, introduces the complete dictionary optimization, including redundant-validity removal. The four Float32 cases cross negative-zero/no-op inputs with all-valid/absent values bitmaps (8,192 rows, 16 dictionary values).
The [adriangbot benchmark results](https://github.com/apache/datafusion/pull/25186#issuecomment-5915237922) compare those commits on GKE (`c4a-standard-32`, Arm Neoverse-V2). Physical-expression evaluation times, in µs, as reported by the bot:
| Contains `-0.0` | Values bitmap | Generic | Optimized |
| --- | --- | ---: | ---: |
| No | Absent | 23.0 ± 0.02 | 22.0 ± 0.01 |
| No | All-valid | 45.2 ± 0.04 | 44.3 ± 0.03 |
| Yes | Absent | 28.9 ± 0.02 | 22.2 ± 0.01 |
| Yes | All-valid | 29.0 ± 0.02 | 22.4 ± 0.02 |
Rewriting cases took about 23% less time (approximately 1.30× speedup); no-rewrite cases took about 2–4% less time. These measurements compare the complete specialization against the generic path, directly isolating the performance change.
To compare the two commits with Criterion:
```bash
git switch --detach f48613118b
cargo bench --profile release-nonlto -p datafusion-physical-expr --bench dictionary_float_zero -- --save-baseline before
git switch --detach e1bd187acd
cargo bench --profile release-nonlto -p datafusion-physical-expr --bench dictionary_float_zero -- --baseline before
```
## Are there any user-facing changes?
Dictionary float normalization and dependent expression evaluation become faster. SQL results, null semantics, and public APIs are unchanged.
--
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: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] perf: optimize dictionary float-zero normalization [datafusion]
Posted by "geoffreyclaude (via GitHub)" <gi...@apache.org>.
geoffreyclaude closed pull request #25912: perf: optimize dictionary float-zero normalization
URL: https://github.com/apache/datafusion/pull/25912
--
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: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] perf: optimize dictionary float-zero normalization [datafusion]
Posted by "codecov-commenter (via GitHub)" <gi...@apache.org>.
codecov-commenter commented on PR #25912:
URL: https://github.com/apache/datafusion/pull/25912#issuecomment-5917562184
## [Codecov](https://app.codecov.io/gh/apache/datafusion/pull/25912?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
:x: Patch coverage is `87.50000%` with `18 lines` in your changes missing coverage. Please review.
:white_check_mark: Project coverage is 82.60%. Comparing base ([`6924c6a`](https://app.codecov.io/gh/apache/datafusion/commit/6924c6a5d45f013f37a2a293387bc6dac7f3d217?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)) to head ([`e1bd187`](https://app.codecov.io/gh/apache/datafusion/commit/e1bd187acd4b57cb291a4f66f2767daf045d80af?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
| [Files with missing lines](https://app.codecov.io/gh/apache/datafusion/pull/25912?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Patch % | Lines |
|---|---|---|
| [...atafusion/physical-expr/src/expressions/in\_list.rs](https://app.codecov.io/gh/apache/datafusion/pull/25912?src=pr&el=tree&filepath=datafusion%2Fphysical-expr%2Fsrc%2Fexpressions%2Fin_list.rs&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-ZGF0YWZ1c2lvbi9waHlzaWNhbC1leHByL3NyYy9leHByZXNzaW9ucy9pbl9saXN0LnJz) | 77.55% | [0 Missing and 11 partials :warning: ](https://app.codecov.io/gh/apache/datafusion/pull/25912?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
| [datafusion/common/src/utils/mod.rs](https://app.codecov.io/gh/apache/datafusion/pull/25912?src=pr&el=tree&filepath=datafusion%2Fcommon%2Fsrc%2Futils%2Fmod.rs&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-ZGF0YWZ1c2lvbi9jb21tb24vc3JjL3V0aWxzL21vZC5ycw==) | 92.30% | [1 Missing and 2 partials :warning: ](https://app.codecov.io/gh/apache/datafusion/pull/25912?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
| [...l-expr/src/expressions/in\_list/primitive\_filter.rs](https://app.codecov.io/gh/apache/datafusion/pull/25912?src=pr&el=tree&filepath=datafusion%2Fphysical-expr%2Fsrc%2Fexpressions%2Fin_list%2Fprimitive_filter.rs&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-ZGF0YWZ1c2lvbi9waHlzaWNhbC1leHByL3NyYy9leHByZXNzaW9ucy9pbl9saXN0L3ByaW1pdGl2ZV9maWx0ZXIucnM=) | 91.17% | [0 Missing and 3 partials :warning: ](https://app.codecov.io/gh/apache/datafusion/pull/25912?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
| [...-expr/src/expressions/in\_list/branchless\_filter.rs](https://app.codecov.io/gh/apache/datafusion/pull/25912?src=pr&el=tree&filepath=datafusion%2Fphysical-expr%2Fsrc%2Fexpressions%2Fin_list%2Fbranchless_filter.rs&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-ZGF0YWZ1c2lvbi9waHlzaWNhbC1leHByL3NyYy9leHByZXNzaW9ucy9pbl9saXN0L2JyYW5jaGxlc3NfZmlsdGVyLnJz) | 95.23% | [0 Missing and 1 partial :warning: ](https://app.codecov.io/gh/apache/datafusion/pull/25912?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
<details><summary>Additional details and impacted files</summary>
```diff
@@ Coverage Diff @@
## main #25912 +/- ##
==========================================
- Coverage 82.60% 82.60% -0.01%
==========================================
Files 1144 1144
Lines 442793 442923 +130
Branches 442793 442923 +130
==========================================
+ Hits 365779 365886 +107
- Misses 54863 54865 +2
- Partials 22151 22172 +21
```
</details>
[:umbrella: View full report in Codecov by Harness](https://app.codecov.io/gh/apache/datafusion/pull/25912?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
:loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
<details><summary> :rocket: New features to boost your workflow: </summary>
- :snowflake: [Test Analytics](https://docs.codecov.com/docs/test-analytics): Detect flaky tests, report on failures, and find test suite problems.
- :package: [JS Bundle Analysis](https://docs.codecov.com/docs/javascript-bundle-analysis): Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
</details>
--
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: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org