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

feat: proto change to support WRITE_OP_UPDATE in WriteRel #733

Closed
wants to merge 2 commits into from

Conversation

scgkiran
Copy link
Contributor

@scgkiran scgkiran commented Nov 6, 2024

No description provided.

Copy link
Member

@EpsilonPrime EpsilonPrime left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. As this is a modification it will require one more approval besides mine.

Copy link
Member

@westonpace westonpace left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The site docs describe the input property for WriteRel as:

The Rel representing which records we will be operating on (e.g., VALUES for an INSERT, or which records to DELETE, or records and after-image of their values for UPDATE).

I interpreted this to suggest that the input to a WriteRel contained the new values. If the new values were defined (in the SQL) as expressions then they would be converted to a project expression before the update.

I'd rather not have two ways to do the same thing so if this is the approach we want then can we fix up the site docs? Also, in doing so I think this would become a breaking change.

I suppose another way to frame the question is if the goal is to more closely mimic SQL or more closely mimic the physical plans that execute the update.

Also, would be good to get some verification on the original intent from @curino or @jacques-n (especially if this is in use somewhere)

@EpsilonPrime
Copy link
Member

It's probably worth looking at the SQL that this is supposed to enable.

UPDATE table_name
SET column1 = value1, column2 = value2, ...
WHERE condition;

table_name and the WHERE clause specify what is to be changed (along with the actual values.

The existing behavior is a complete replacement. (Essentially delete all existing rows and add this input.). We should strive to only update the rows that are changing if possible.

@jacques-n
Copy link
Contributor

Discussed this some on sync call today. I think there are two different patterns we should support. The current one is good if you assume implicit row ids (a physical concept).

I suggest we introduce a separate relation which maps more logically to sql.

@jacques-n
Copy link
Contributor

jacques-n commented Nov 7, 2024

I'm going to close this PR as probably not the optimal changes.

@jacques-n jacques-n closed this Nov 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants