Datastore: support property transforms without specifying client values#1
Merged
dnerdy merged 1 commit intov1.21.0_khanfrom Feb 5, 2026
Merged
Conversation
Summary: This PR enables callers to pass in an empty entity when creating a mutation or calling PutWithOptions to indicate that no client values should be written when performing property transforms on the serfver. Currently passing in an entity (or an empty entity) overwrites (or deletes) the server values before applying the transforms because the PropertyMask on the mutation isn't set (which means the server should update the entity on the server to match all client provided values). See the comment on setMutationProtoPropertyMaskForTransforms for additional details. Fixes googleapis#13746, though as mentioned in that issue, it might be better to have a separate API that constructs a properly configured mutation that just applies property transforms. (Or, if the current API is kept, it might be nice to allow passing a nil entity when using transforms.) Test Plan: I ran the old and new transform integration tests: ``` GCLOUD_TESTS_GOLANG_PROJECT_ID=khan-prototype go test -run TestIntegration_Transforms_PutAndTransform GCLOUD_TESTS_GOLANG_PROJECT_ID=khan-prototype go test -run TestIntegration_Transforms_TransformOnly ```
csilvers
approved these changes
Feb 4, 2026
Member
csilvers
left a comment
There was a problem hiding this comment.
I read the commit message here and the issue description at googleapis#13746, and while I'm not very familiar with how transforms work -- except, it seems, "not very well" :-} -- what is happening here seems reasonable to me. Hopefully they'll have a fix upstream soon.
Author
Thanks for the review! |
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.
Summary:
This PR enables callers to pass in an empty entity when creating a mutation or calling PutWithOptions to indicate that no client values should be written when performing property transforms on the server. Currently passing in an entity (or an empty entity) overwrites (or deletes) the server values before applying the transforms because the PropertyMask on the mutation isn't set (which means the server should update the entity on the server to match all client provided values).
See the comment on setMutationProtoPropertyMaskForTransforms for additional details.
Fixes googleapis#13746, though as mentioned in that issue, it might be better to have a separate API that constructs a properly configured mutation that just applies property transforms. (Or, if the current API is kept, it might be nice to allow passing a nil entity when using transforms.)
Test Plan:
I ran the old and new transform integration tests: