Repository navigation
Refactor runtime filter hierarchy - #109620
Conversation
|
Workflow [PR], commit [4f099f4] Summary: ✅
AI ReviewSummaryThis PR refactors the join runtime-filter implementation into a Missing context / blind spots
Final Verdict✅ No new blocking or major findings in the current revision. LLVM Coverage ReportMeasured on commit 4f099f4.
Changed lines: Changed C/C++ lines covered: 994/1017 (97.74%) · Uncovered code |
03394_distributed_shuffle_join_with_aggregation under runtime-filter randomization
#112026
This comment was marked as outdated.
This comment was marked as outdated.
Build profile diff (arm_release)Comparing ✅ No significant changes. Binary sizes
The official master build is compiled with Object file sizes46 object files changed (+202.50 KiB total), 0 added.
716 more object files are built by the master warmup baseline only (it builds every object-file target, a pull request build only Compile time of recompiled translation units210 translation units recompiled, 2359 s compile time in total, 210 of them have a recent master baseline. |
HashJoin::publishSharedRuntimeFilters() can replace a lookup entry with a prebuilt SharedFixedHashTableRuntimeFilter as soon as the last build-side port is closed, while BuildRuntimeFilterTransform::finish() (which reaches RuntimeFilter::merge via IRuntimeFilterLookup::add) only runs afterwards in prepare(). The refactor turned that previously tolerated late registration (SharedFixedHashTableRuntimeFilter::merge was a no-op) into a LOGICAL_ERROR because the variant arms differ. Restore the no-op behavior when the destination is the shared prebuilt filter: it probes the complete build-side hash table, a superset of anything a late set/bloom filter could contribute, so dropping the merge is correct. Add a regression test simulating the replace-then-late-add interleaving.
Before the refactor ApproximateRuntimeFilter::findImpl fed updateStats with the match count returned by BloomFilter::findHashPairs while filling the mask. The refactored generic RuntimeFilter::find recomputed the count with countPassedStats(result), adding a second full scan over the mask for every approximate probe block - the hot path once the exact set overflows. Thread an optional rows_passed out-parameter through the concrete filters' find: the bloom probe reports its in-loop count, the exact/shared paths leave it unset and keep the previous countPassedStats fallback.
| insertIntoBloomFilter(getValuesColumn()); | ||
| ColumnPtr RuntimeFilter::find(const ColumnWithTypeAndName & values) const | ||
| { | ||
| return data.accessReadOnly( |
There was a problem hiding this comment.
Why is the shared lock necessary in this case, will there be any write during this process?
There was a problem hiding this comment.
find reads the protected filter state, but other threads can still enter writer paths. For example, a late registration can call finishInsert, which writes the non-atomic inserts_are_finished flag that find reads in assertCanFind
diegomestre2
left a comment
There was a problem hiding this comment.
No further remarks or requests. Great work with the refactoring.
|
Resolved conflicts with #118336 |
|
@cv4g @diegomestre2 — title/description suggestions: Description (currently
Ignore if intentional. |
This PR intends to refactor join runtime-filter internals for better separation of concerns.
The
IRuntimeFilterclass hierarchy is decomposed into aRuntimeFilterupper layer and concrete filter implementations on the lower layer.Runtime Filter configuration, build state and evaluation state are factored out and the
ApproximateRuntimeFilteris split into a bloom-filter onlyApproximateSetRuntimeFilterand anAdaptiveSetRuntimeFilter.AdaptiveSetRuntimeFilterdelegates to anExactSetRuntimeFilterin the beginning and then conditionally switches toApproximateSetRuntimeFilterwhen full.The change also co-locates per-key runtime-filter construction in
joinRuntimeFilterand carries the join-keycommon_typeinto shared fixed-hash-table publication. This letsHashJoin::publishSharedRuntimeFiltersdecide whether to replace theSet/BloomFilterusing the same type used byBuildRuntimeFilterStepand__applyFilter. Before this type was obtained via the runtime filter indirectly.No functional changes.
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Not for changelog.
Workflow [PR]
Sync PR [sync-upstream/pr/109620]
Version info
26.9.1.1107(included in26.9and later)