dbsp: Fix hidden dependency on vec-based batches in input_upsert. #1913
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.
The vec-based batches set keys, values, and weights to their default values when their builders accept tuples via
Builder::push
orBuilder::push_vals
, which take mutable references. The code forinput_upsert
accumulates updates to keys in akey_updates
vector, and then adds them to a builder viaextend
, which internally usesBuilder::push
and thus clears all the updates that were added to have weight 0.Before this commit, that code didn't later clear the
key_updates
vector, which meant that anything added later was appended to a bunch of zeroed tuples. This was benign because, the next timekey_updates
was used, it was first consolidated, which meant that all the zero-weight tuples were dropped.This failed with the file-based batches, which don't have any special optimizations for mutable references and thus don't zero anything, which meant that nothing in
key_updates
ever got cleared. This commit fixes the problem by properly clearingkey_updates
to empty after using it.Is this a user-visible change (yes/no): ___