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(on conflict): add with version column clause and behavior #16091

Merged
merged 23 commits into from
Apr 10, 2024

Conversation

wcy-fdu
Copy link
Contributor

@wcy-fdu wcy-fdu commented Apr 2, 2024

I hereby agree to the terms of the RisingWave Labs, Inc. Contributor License Agreement.

What's changed and what's your intention?

related to #15515.
This pr introduce WITH VERSION COLUMN(column_name) clause, as a supplementary constraint on conflict behavior. WITH VERSION COLUMN only applies to the two conflict behaviors of overwrite and do update if not null. When the version column is specified, the corresponding handle will continue to be executed only when the version column of the new row is greater than or equal to the version column of the old row. conflict behavior.

Checklist

  • I have written necessary rustdoc comments
  • I have added necessary unit tests and integration tests
  • I have added test labels as necessary. See details.
  • I have added fuzzing tests or opened an issue to track them. (Optional, recommended for new SQL features Sqlsmith: Sql feature generation #7934).
  • My PR contains breaking changes. (If it deprecates some features, please create a tracking issue to remove them in the future).
  • All checks passed in ./risedev check (or alias, ./risedev c)
  • My PR changes performance-critical code. (Please run macro/micro-benchmarks and show the results.)
  • My PR contains critical fixes that are necessary to be merged into the latest release. (Please check out the details)

Documentation

  • My PR needs documentation updates. (Please use the Release note section below to summarize the impact on users)

Release note

If this PR includes changes that directly affect users or other significant modifications relevant to the community, kindly draft a release note to provide a concise summary of these changes. Please prioritize highlighting the impact these changes will have on users.

@wcy-fdu wcy-fdu marked this pull request as draft April 2, 2024 12:04
@wcy-fdu wcy-fdu marked this pull request as ready for review April 3, 2024 01:57
@wcy-fdu wcy-fdu requested review from hzxa21 and st1page April 3, 2024 02:03
Copy link
Contributor

@st1page st1page left a comment

Choose a reason for hiding this comment

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

please also return error in frontend when it is not actually implemented in the executor

src/meta/model_v2/src/table.rs Outdated Show resolved Hide resolved
@wcy-fdu wcy-fdu changed the title feat(on conflict): add with version column clause in frontend feat(on conflict): add with version column clause and behavior Apr 8, 2024
@wcy-fdu wcy-fdu requested a review from yezizp2012 April 10, 2024 09:02
@wcy-fdu wcy-fdu requested a review from yezizp2012 April 10, 2024 09:18
@wcy-fdu wcy-fdu enabled auto-merge April 10, 2024 11:02
@wcy-fdu wcy-fdu added this pull request to the merge queue Apr 10, 2024
Merged via the queue into main with commit f82821d Apr 10, 2024
33 of 34 checks passed
@wcy-fdu wcy-fdu deleted the wcy/with_version_column branch April 10, 2024 11:31
@BugenZhao
Copy link
Member

as title.

I'm sorry but I didn't get the intention of this 400+ LoC PR from the title. Can you elaborate more? Should there be an issue for this?

By the way, is this PR considered a user-facing change? If so, please specify the release note and label the PR.

cc @st1page Kindly suggest taking the above into consideration when reviewing a PR.

@wcy-fdu
Copy link
Contributor Author

wcy-fdu commented Apr 11, 2024

as title.

I'm sorry but I didn't get the intention of this 400+ LoC PR from the title. Can you elaborate more? Should there be an issue for this?

By the way, is this PR considered a user-facing change? If so, please specify the release note and label the PR.

cc @st1page Kindly suggest taking the above into consideration when reviewing a PR.

This is a user request feature(detail in #15515 and doc in risingwavelabs/risingwave-docs#1860), which uses partial update for the scene of widening the table as the performance of multiway join is relatively poor.
eg.

CREATE TABLE d1(v1 int, k int primary key);
CREATE TABLE d2(v2 int, k int primary key);
CREATE TABLE d3(v3 int, k int primary key);
CREATE TABLE wide_d(v1 int, v2 int, v3 int, k primary key)
ON CONFLICT DO UPDATE IF NOT NULL;

CREATE SINK sink1 INTO wide_d (v1, k) AS
  SELECT v1, k FROM d1
  with (
      type = 'append-only',
      force_append_only = 'true',
  );
CREATE SINK sink2 INTO wide_d (v2, k) AS
  SELECT v2, k FROM d2
  with (
      type = 'append-only',
      force_append_only = 'true',
  );
CREATE SINK sink3 INTO wide_d (v3,k) AS 
  SELECT v3, k FROM d3
  with (
      type = 'append-only',
      force_append_only = 'true',
  );

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants