-
Notifications
You must be signed in to change notification settings - Fork 189
Upserts with more selective update functionality #593
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
It seems possible. It's perhaps related to this PR from a while back, that also attempts to deconstruct the arrangement forming operators in a way that allows more generality. I think the main caveat at the moment is that But also, if this help: the intent with all of DD is that it is a la carte, and if you'd like a different |
Thanks for the feedback! I'd hope that we could rely on If I understand this correctly, this seems to require a cyclic dataflow, and I'm not sure what the most idiomatic solution would be. E.g. if I wanted to delete values by key from an arrangement, would I perform a |
I think it doesn't. At least, the intent of the PR when written (or, my memory thereof; perhaps it is totally at odds with the PR) is that no cycles are required, on account of the "feedback" is key-local. The same way that previous iterates inform the I may also have misunderstood what "this" refers to (answered as if "that linked Pr there").
Yup, all I mean to say is that the surface area there may be changing. For example, the trace batch building API is in flux at the moment, and will likely be changed in a way that accumulates more updates before feeding them to a builder, so that the builder has more of a chance to plan for their insertion (e.g. right sizing allocations, compression, etc). The details of |
The already available
arrange_from_upsert
function has the following signature:The stream of updates only allows for either deletion (
None
) of existing entries, or complete replacement of the value associated with a key withSome(new_value)
. But sometimes we want to update only part of an existing value.We were thinking of a function with maybe the following signature:
This adds two more generic types:
U
(update information) andF
for an additional closure argumentupdate_func
that combines the key, an optional existing value, and the update information to generate an optional replacement.Note that the current
arrange_from_upsert
function could be easily implemented on top of the above new function.U
would be the same asV
in that case, andupdate_func
would return the optional replacementSome(new_value)
if there wereSome(old_value)
, orNone
otherwise.There are at least two advantages offered by the new function:
update_func
can detect and act on the case where a key is missing (None
being passed as argument), e.g. for emitting warnings if that indicates a problem.It seems the suggested new function could be easily implemented reusing the existing code for
arrange_from_upsert
. Unless the compiler cannot optimize away the abstractions, we could then replace it with a suitable call toarrange_from_update
.Would it be possible to add this feature, or maybe comment on any potential issues with the proposal?
The text was updated successfully, but these errors were encountered: