Add a join_core_yielding
operator
#390
Open
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.
This PR poses an alternative to #389 that doesn't require changing the way effort is counted in the join operator. Instead it adds a
JoinCore::join_core_yielding
operator that allows specifying ayield_function
to control the join's yield behavior, similarly to how the half join operator is configurable. Theyield_function
enables yielding based on time and number of produced records.The
yield_function
replaces the previous fueling concept used by the join operator. Higher-level join operators that don't explicitly specify ayield_function
still have the old behavior of yielding after 1 million produced records, so backwards-compatibility is maintained for all but direct users ofjoin_core_internal_unsafe
.Some additional care is taken to ensure the
yield_function
is only checked after the join has made some progress. This is to avoid stuck joins caused by overly aggressiveyield_function
s. However, nothing prevents users from shooting themselves in the foot by specifying an overly lenientyield_function
(e.g. one that always returnsfalse
) and then potentially running into OOMs. The current implementation can easily be modified to enforce a yield when the effort reaches a hardcoded value, if we think this safeguard would be valuable.