Repository navigation
perf(scoring): retain only filter-accepted join rows, without identity tables - #291
Merged
Merged
Conversation
…joins Every fluent stream filter now runs as the row filter of the join it reads, so a rejected row is never retained. FilterPredicate gains ACCEPTS_ALL so an unfiltered self-join never resolves a combination only to test it.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Joins no longer retain rows their stream filter rejects, and no longer keep identity tables to deduplicate output.
What changes
JoinNodeemits each pair once without the globaloutputsmap: a pair is only found twice in one change when both of its rows were inserted by that change, so the right probe skips left rows stamped with the current change. A per-input live map keeps repeated insertion a no-op.SelfJoinNodekeeps each row's key and bucket position and each combination's link positions. Retraction previously scanned every key bucket to find the row's key, and calledretainon each member's tuple list; it now touches only the row's own bucket and combinations. Thecombosmap is gone, and inserting a live row is now a no-op (it used to be pushed into its bucket twice).ComplementNodedropsreal_outputsthe same way.group_byinputs and all same-collection streams) is now the row filter of the join it reads:JoinNode::filtered,SelfJoinNode::filtered. It runs when a row is found, before the row is retained, so rejected rows cost one predicate call and nothing else. TheBiScored/TriScored/QuadScored/PentaScored/FlattenedBiScoredwrappers and theFilterNodes over joins are removed.FilterPredicategainsACCEPTS_ALL(defaultfalse;trueforAcceptAll), so an unfiltered self-join never resolves a combination only to test it.Chain::filterkeeps itsFilterNode:Chain::newaccepts any operator tree.Public API:
JoinNodeandSelfJoinNodegain a defaulted row-filter parameter, plusfilteredconstructors,AcceptAll,SelfJoinRowFilterandFilterPredicate::ACCEPTS_ALL. Existing code compiles unchanged.public-api.txt, the scoring wireframe anddocs/extend-scoring.mdare updated.Verification
make test,make lint(incl. public-api, doc-names, file-length),cargo clippy --workspace --all-targets --all-features -D warnings.scoring_joins(self-join, same-source cross join, filtered cross join),gate-smoke.sh v0.31.5 scoring_joins 32: equalorder_hashand scoreidentity_hash; wall 812 ms → 68 ms, allocations 2,202,055 → 6,829, peak live bytes 10.0 MB → 0.53 MB.hs-e10000-s100000, 60 s on one core, bench adapter built against each tree: v0.31.5 places 45,074 shifts (−54,926 hard), this branch places all 100,000 in 58.8 s (0 hard); 7.23 → 3.10 µs per evaluated construction move.The full zero-regression gate runs on merged main against v0.31.5.