Skip to content
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

Support multiple Update operations for the same column #1525

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

Support multiple Update operations for the same column #1525

ivan-zaitsev opened this issue Oct 14, 2024 · 2 comments
Labels
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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

3 participants