You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@datafusion.apache.org by "2010YOUY01 (via GitHub)" <gi...@apache.org> on 2026/10/16 08:01:44 UTC
[PR] Revert #25363 due to overlapping optimizations [datafusion]
2010YOUY01 opened a new pull request, #26410:
URL: https://github.com/apache/datafusion/pull/26410
## Which issue does this PR close?
<!--
We generally require a GitHub issue to be filed for all bug fixes and enhancements and this helps us generate change logs for our releases. You can link an issue to this PR using the GitHub syntax. For example `Closes #123` indicates that this PR will close issue #123.
-->
- Closes #.
## Rationale for this change
<!--
Why are you proposing this change? If this is already explained clearly in the issue then this section is not needed.
Explaining clearly why changes are proposed helps reviewers understand your changes and offer better suggestions for fixes.
Please explain the problem you are trying to solve in terms of the user-visible
behavior, rather than the implementation.
For example, "The code in `foo.rs` doesn't handle nulls" is a symptom of the
implementation. "COUNT(DISTINCT) returns wrong results when the column contains
nulls" is the user-visible problem.
-->
See discussion for details: [https://github.com/apache/datafusion/pull/25363](https://github.com/apache/datafusion/pull/25363)
TLDR: The optimization itself is great, but might not be a good perf v.s. complexity tradeoff, so I overall think it's better to revert.
This PR introduces an integer-key prefilter for Hash Join, which overlaps with the existing `ArrayMap` optimization.
For example, consider a Hash Join on a `UInt64` key, where the build-side key range is `[1, 100]`:
- **ArrayMap:** Replaces the hash table with a flat array for direct lookup.
- **This PR:** Keeps the hash table but adds a bitmap prefilter to skip unnecessary hash table lookups.
The tradeoff is:
- **ArrayMap:** Faster, but uses more memory.
- **Prefilter + HashMap:** Slower, but more memory-efficient, particularly for sparse key ranges.
The concern is **whether the benefits justify the additional maintenance overhead**:
1. It introduces 4 configuration options, while `ArrayMap` already has a similar threshold configuration.
2. Having two closely related optimizations makes execution behavior harder to predict and maintain.
This seem very hard to tune them right. I've considered simplifying the thresholds or integrating the prefilter with existing mechanisms, but neither seems straightforward.
In the [[original discussion](https://github.com/apache/datafusion/pull/25363#issuecomment-6183169314)](https://github.com/apache/datafusion/pull/25363#issuecomment-6183169314), @lyne7-sc provided benchmarks confirming the tradeoff, and also expressed uncertainty about whether the extra maintenance is worthwhile.
**My overall recommendation is to revert this optimization for simplification**, given our limited engineering capacity and current maintenance burden. (I think the optimization is a good idea, we can still think about introducing it in the future, but try to be more general-purpose and easier to configure)
I'd love to hear others' thoughts.
## What changes are included in this PR?
<!--
There is no need to duplicate the description in the issue here, but it is sometimes worth providing a summary of the individual changes in this PR.
-->
commit 1 is pure change revert
commit 2 is some fixing due to main updates
## What is the testing strategy for this PR?
<!--
We typically require tests for all PRs in order to:
1. Prevent the code from being accidentally broken by subsequent changes
2. Serve as another way to document the expected behavior of the code
Briefly describe how this PR is tested, and point to the specific tests you added. For example: 'This new feature is covered by the `sqllogictest` cases added in `foo.slt`'.
If this PR does not add tests, explain why. For example, if the change is already covered by existing tests, please mention it.
You should also check the `codecov` bot reply on this PR to confirm the changed code is exercised.
-->
## Are there any user-facing changes?
<!--
If there are user-facing changes then we may require documentation to be updated before approving the PR.
If there are any breaking changes to public APIs, please add the `api change` label.
-->
--
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] Revert #25363 due to overlapping optimizations [datafusion]
Posted by "codecov-commenter (via GitHub)" <gi...@apache.org>.
codecov-commenter commented on PR #26410:
URL: https://github.com/apache/datafusion/pull/26410#issuecomment-6212921008
## [Codecov](https://app.codecov.io/gh/apache/datafusion/pull/26410?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
:white_check_mark: All modified and coverable lines are covered by tests.
:white_check_mark: Project coverage is 82.85%. Comparing base ([`5009f42`](https://app.codecov.io/gh/apache/datafusion/commit/5009f42e4a24d231580222e5628c1e203f07614b?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)) to head ([`562b1f1`](https://app.codecov.io/gh/apache/datafusion/commit/562b1f14152af24a7ac4263765e840842174f0f1?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
:warning: Report is 1 commits behind head on main.
<details><summary>Additional details and impacted files</summary>
```diff
@@ Coverage Diff @@
## main #26410 +/- ##
==========================================
- Coverage 82.87% 82.85% -0.02%
==========================================
Files 1153 1152 -1
Lines 457101 456554 -547
Branches 457101 456554 -547
==========================================
- Hits 378818 378295 -523
- Misses 55268 55270 +2
+ Partials 23015 22989 -26
```
</details>
[:umbrella: View full report in Codecov by Harness](https://app.codecov.io/gh/apache/datafusion/pull/26410?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
Re: [PR] Revert #25363 due to overlapping optimizations [datafusion]
Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb commented on PR #26410:
URL: https://github.com/apache/datafusion/pull/26410#issuecomment-6276354676
let's bias towards simplifying things. Thanks
--
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] Revert #25363 due to overlapping optimizations [datafusion]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #26410:
URL: https://github.com/apache/datafusion/pull/26410#issuecomment-6212311595
<!-- semver-check-comment -->
Thank you for opening this pull request!
Reviewer note: [cargo-semver-checks](https://github.com/obi1kenobi/cargo-semver-checks) reported the current version number is not SemVer-compatible with the changes in this pull request (compared against the base branch).
<details>
<summary>Details</summary>
```
Cloning apache/main
Building datafusion-common v55.1.0 (current)
Built [ 21.800s] (current)
Parsing datafusion-common v55.1.0 (current)
Parsed [ 0.047s] (current)
Building datafusion-common v55.1.0 (baseline)
Built [ 21.527s] (baseline)
Parsing datafusion-common v55.1.0 (baseline)
Parsed [ 0.047s] (baseline)
Checking datafusion-common v55.1.0 -> v55.1.0 (no change; assume patch)
Checked [ 0.530s] 229 checks: 228 pass, 1 fail, 0 warn, 31 skip
--- failure struct_pub_field_missing: pub struct's pub field removed or renamed ---
Description:
A publicly-visible struct has at least one public field that is no longer available under its prior name. It may have been renamed or removed entirely.
ref: https://doc.rust-lang.org/cargo/reference/semver.html#item-remove
impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.51.0/src/lints/struct_pub_field_missing.ron
Failed in:
field enable_join_integer_prefilter of struct ExecutionOptions, previously in file /home/runner/work/datafusion/datafusion/target/semver-checks/git-apache_main/e2803d65a59ed8ceb4ac3f1c37f866e1bdceb3ae/datafusion/common/src/config.rs:897
field join_integer_prefilter_max_key_range of struct ExecutionOptions, previously in file /home/runner/work/datafusion/datafusion/target/semver-checks/git-apache_main/e2803d65a59ed8ceb4ac3f1c37f866e1bdceb3ae/datafusion/common/src/config.rs:897
field join_integer_prefilter_min_pruning_ratio of struct ExecutionOptions, previously in file /home/runner/work/datafusion/datafusion/target/semver-checks/git-apache_main/e2803d65a59ed8ceb4ac3f1c37f866e1bdceb3ae/datafusion/common/src/config.rs:897
field join_integer_prefilter_sample_rows of struct ExecutionOptions, previously in file /home/runner/work/datafusion/datafusion/target/semver-checks/git-apache_main/e2803d65a59ed8ceb4ac3f1c37f866e1bdceb3ae/datafusion/common/src/config.rs:897
Summary semver requires new major version: 1 major and 0 minor checks failed
Finished [ 45.473s] datafusion-common
Building datafusion-optimizer v55.1.0 (current)
Built [ 16.581s] (current)
Parsing datafusion-optimizer v55.1.0 (current)
Parsed [ 0.023s] (current)
Building datafusion-optimizer v55.1.0 (baseline)
Built [ 16.565s] (baseline)
Parsing datafusion-optimizer v55.1.0 (baseline)
Parsed [ 0.024s] (baseline)
Checking datafusion-optimizer v55.1.0 -> v55.1.0 (no change; assume patch)
Checked [ 0.130s] 229 checks: 229 pass, 31 skip
Summary no semver update required
Finished [ 34.138s] datafusion-optimizer
Building datafusion-physical-plan v55.1.0 (current)
Built [ 22.729s] (current)
Parsing datafusion-physical-plan v55.1.0 (current)
Parsed [ 0.137s] (current)
Building datafusion-physical-plan v55.1.0 (baseline)
Built [ 22.671s] (baseline)
Parsing datafusion-physical-plan v55.1.0 (baseline)
Parsed [ 0.136s] (baseline)
Checking datafusion-physical-plan v55.1.0 -> v55.1.0 (no change; assume patch)
Checked [ 0.479s] 229 checks: 229 pass, 31 skip
Summary no semver update required
Finished [ 47.486s] datafusion-physical-plan
Building datafusion-sqllogictest v55.1.0 (current)
Built [ 59.608s] (current)
Parsing datafusion-sqllogictest v55.1.0 (current)
Parsed [ 0.012s] (current)
Building datafusion-sqllogictest v55.1.0 (baseline)
Built [ 60.138s] (baseline)
Parsing datafusion-sqllogictest v55.1.0 (baseline)
Parsed [ 0.013s] (baseline)
Checking datafusion-sqllogictest v55.1.0 -> v55.1.0 (no change; assume patch)
Checked [ 0.076s] 229 checks: 229 pass, 31 skip
Summary no semver update required
Finished [ 121.926s] datafusion-sqllogictest
```
</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
Re: [PR] Revert #25363 due to overlapping optimizations [datafusion]
Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb merged PR #26410:
URL: https://github.com/apache/datafusion/pull/26410
--
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