Skip to content

Support multiple Update operations for the same column #1525

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

Open
ivan-zaitsev opened this issue Oct 14, 2024 · 5 comments
Open

Support multiple Update operations for the same column #1525

ivan-zaitsev opened this issue Oct 14, 2024 · 5 comments
Assignees
Labels
status: ideal-for-contribution An issue that a contributor can help us with type: enhancement A general enhancement

Comments

@ivan-zaitsev
Copy link

ivan-zaitsev commented Oct 14, 2024

Update stores one column name as key and one operation as value.

Because of this it is not possible to update several keys for column with map type.

Example of code:

CREATE TABLE data (fields map<VARCHAR, VARCHAR>);
List<Update.AssignmentOp> updateOperations = new LinkedList<>();
updateOperations.add(new Update.SetAtKeyOp(ColumnName.from("map"), "key1", "value1"));
updateOperations.add(new Update.SetAtKeyOp(ColumnName.from("map"), "key2", "value2"));
Update update = Update.of(updateOperations);

OR

Update update = Update.empty()
        .set("map").atKey("key1").to("value1")
        .set("map").atKey("key2").to("value2");

only one of operations will be present in update object.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Oct 14, 2024
@ivan-zaitsev
Copy link
Author

ivan-zaitsev commented Oct 14, 2024

As a workaround possible to create custom ColumnName which will return different equals/hashCode to identical column names.

@mp911de mp911de added type: enhancement A general enhancement and removed status: waiting-for-triage An issue we've not yet triaged labels Oct 15, 2024
@mp911de mp911de changed the title Update doesn't support multiple set operations for map column Support multiple Update operations for the same column Oct 15, 2024
@mp911de
Copy link
Member

mp911de commented Oct 15, 2024

This is indeed a limitation of the current implementation. Our API should be able to support multiple operations per column and that will be a neat enhancement.

@nemogpt
Copy link

nemogpt commented Mar 14, 2025

Hi @mp911de Could you confirm if this still needs to be fixed?

@mp911de
Copy link
Member

mp911de commented Mar 19, 2025

Confirmed. Update should contain a List of operations and and we need to define what happens if you try to update the same element (same column or same key in a map) twice. Replacing (as of today) seems a good idea, we also should document what we're doing.

@mp911de mp911de added the status: ideal-for-contribution An issue that a contributor can help us with label Mar 19, 2025
@nemogpt
Copy link

nemogpt commented Mar 19, 2025

could you pls assign this ticket to me, so that i can start with it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: ideal-for-contribution An issue that a contributor can help us with type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

4 participants