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

fix(frontend): fix changelog out_col_change error and add snowflake upsert sink demo #17515

Merged
merged 4 commits into from
Jul 2, 2024

Conversation

xxhZs
Copy link
Contributor

@xxhZs xxhZs commented Jul 1, 2024

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

What's changed and what's your intention?

Forgot to add _changelog_row_id records in out_col_change , this is an error.

Added demo that implements snowflake upsert sink using changelog

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

Need to add the demo to the documentation

@xxhZs xxhZs added the user-facing-changes Contains changes that are visible to users label Jul 1, 2024
@github-actions github-actions bot added the type/fix Bug fix label Jul 1, 2024
@xxhZs xxhZs requested a review from chenzl25 July 1, 2024 07:52
fix

fi
@xxhZs xxhZs force-pushed the xxh/snowflake-upsert-demo branch from 37c05a6 to 0522b2b Compare July 1, 2024 07:55
@xxhZs xxhZs requested a review from hzxa21 July 1, 2024 08:03
src/frontend/src/optimizer/plan_node/logical_changelog.rs Outdated Show resolved Hide resolved
src/frontend/src/optimizer/plan_node/logical_changelog.rs Outdated Show resolved Hide resolved
Comment on lines 81 to 86
let out_col_change = if self.base.stream_key().is_none() {
ColIndexMapping::new(output_vec, len + 1)
} else {
(changelog, input_col_change)
}
output_vec.push(Some(len));
ColIndexMapping::new(output_vec, len + 1)
};
Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't get this logic, probably because I am not familiar with the optimzier codes. But it seems that we are relying on some implicit assumption here. Can you elaborate more?

  • Why do we need to extend the ColIndexMapping without extending output_vec when the stream key is none?
  • When will the stream key be none?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

stream_key.is_none means that _changelog_row_id is not included in the select result. This has been changed to need_changelog_row_id to make the logic clearer.
When the results does not contain _changelog_row_id , _changelog_row_id is the hidden column added by this operator, and the ColIndexMapping should be null->index (here is len)

Copy link
Contributor

@chenzl25 chenzl25 left a comment

Choose a reason for hiding this comment

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

LGTM

@xxhZs xxhZs added this pull request to the merge queue Jul 2, 2024
Copy link
Collaborator

@hzxa21 hzxa21 left a comment

Choose a reason for hiding this comment

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

LGTM

Merged via the queue into main with commit d9a90d6 Jul 2, 2024
32 of 33 checks passed
@xxhZs xxhZs deleted the xxh/snowflake-upsert-demo branch July 2, 2024 06:49
xxhZs added a commit that referenced this pull request Aug 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/fix Bug fix user-facing-changes Contains changes that are visible to users
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants