Support multiple Update operations for the same column name#1596
Closed
m3k0813 wants to merge 1 commit intospring-projects:mainfrom
Closed
Support multiple Update operations for the same column name#1596m3k0813 wants to merge 1 commit intospring-projects:mainfrom
Update operations for the same column name#1596m3k0813 wants to merge 1 commit intospring-projects:mainfrom
Conversation
Previously, the `Update` class used a `Map` to store its operations, keyed by column name. This prevented multiple operations on the same column, such as setting different keys in a map-type column, as later operations would overwrite earlier ones. This commit changes the internal data structure to a `List`, allowing multiple operations to be recorded. To align with the 'last-wins' semantics for conflicting operations (e.g., setting the same column twice), a conflict resolution mechanism has been added. New operations now replace existing, conflicting ones. Adds comprehensive unit tests to verify both the coexistence of non-conflicting operations and the replacement of conflicting ones. Signed-off-by: Jeongjun Min <m3k0813@gmail.com>
mp911de
approved these changes
Aug 11, 2025
Member
mp911de
left a comment
There was a problem hiding this comment.
Thanks a lot. This looks pretty decent. I'm going to polish this pull request for inclusion in the next release.
| @Override | ||
| public String toString() { | ||
| return StringUtils.collectionToDelimitedString(updateOperations.values(), ", "); | ||
| private static boolean equalsNullSafe(@Nullable Object a, @Nullable Object b) { |
Member
There was a problem hiding this comment.
This method isn't needed, use ObjectUtils.nullSafeEquals(…) instead.
Contributor
Author
|
Thanks for the review and the feedback, @mp911de! I'm glad you liked the contribution :) |
Update operations for a column
Update operations for a columnUpdate operations for the same column name
mp911de
pushed a commit
that referenced
this pull request
Aug 11, 2025
Previously, the `Update` class used a `Map` to store its operations, keyed by column name. This prevented multiple operations on the same column, such as setting different keys in a map-type column, as later operations would overwrite earlier ones. This commit changes the internal data structure to a `List`, allowing multiple operations to be recorded. To align with the 'last-wins' semantics for conflicting operations (e.g., setting the same column twice), a conflict resolution mechanism has been added. New operations now replace existing, conflicting ones. Adds comprehensive unit tests to verify both the coexistence of non-conflicting operations and the replacement of conflicting ones. Signed-off-by: Jeongjun Min <m3k0813@gmail.com> See #1525 Original pull request: #1596
mp911de
pushed a commit
that referenced
this pull request
Aug 11, 2025
Previously, the `Update` class used a `Map` to store its operations, keyed by column name. This prevented multiple operations on the same column, such as setting different keys in a map-type column, as later operations would overwrite earlier ones. This commit changes the internal data structure to a `List`, allowing multiple operations to be recorded. To align with the 'last-wins' semantics for conflicting operations (e.g., setting the same column twice), a conflict resolution mechanism has been added. New operations now replace existing, conflicting ones. Adds comprehensive unit tests to verify both the coexistence of non-conflicting operations and the replacement of conflicting ones. Signed-off-by: Jeongjun Min <m3k0813@gmail.com> See #1525 Original pull request: #1596
Member
|
Thank you for your contribution. That's merged, polished, and backported now. |
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.
Fixes #1525
This PR enhances the
Updateclass to support multiple operations on the same column, resolving the limitation of the previousMap-based implementation.Changed the internal data structure of
UpdatefromMap<ColumnName, AssignmentOp>toList<AssignmentOp>. This allows multiple non-conflicting operations (e.g., setting different keys in a map) to coexist.Introduced a conflict resolution mechanism to handle duplicate or conflicting operations. The new implementation follows a "last-wins" policy, as suggested in the issue discussion. For example, a
set("name", "B")operation will replace a previousset("name", "A").Added a comprehensive suite of unit tests to
UpdateUnitTeststo verify both the coexistence of non-conflicting operations and the "last-wins" replacement policy for various edge cases.