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

refactor(connector): migrate to zero-copy access implementation #17165

Merged
merged 1 commit into from
Jun 10, 2024

Conversation

BugenZhao
Copy link
Member

@BugenZhao BugenZhao commented Jun 7, 2024

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

What's changed and what's your intention?

Follow-up of #17153.

  • Adopt access_cow in all implementors of Access.
  • Use access_cow everywhere if possible.
  • Rename access_cow to access and make it the only method that need/can be implemented in the trait.
  • Rename access to access_owned to implicitly show the intention of requiring an owned datum in the callsite. Make it an extension trait, so that it cannot be overridden.
  • Some minor tweaks.

Checklist

  • I have written necessary rustdoc comments
  • I have added necessary unit tests and integration tests
  • All checks passed in ./risedev check (or alias, ./risedev c)

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.

@BugenZhao BugenZhao force-pushed the bz/parser-perf-3 branch 2 times, most recently from 6c011d7 to 1ad1b1f Compare June 7, 2024 08:22
@BugenZhao BugenZhao changed the title refactor(connector): adopt zero-copy access more refactor(connector): migrate to zero-copy access implementation Jun 7, 2024
@BugenZhao BugenZhao marked this pull request as ready for review June 10, 2024 02:46
@BugenZhao BugenZhao requested a review from a team as a code owner June 10, 2024 02:46
Copy link
Member

@xxchan xxchan left a comment

Choose a reason for hiding this comment

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

👍

Comment on lines 59 to 62
/// Similar to `access`, but may return a borrowed [`DatumCow::Borrowed`] to avoid unnecessary allocation.
/// If not overridden, it will call forward to `access` and always wrap the result in [`DatumCow::Owned`].
///
/// This should be preferred over `access` for both callers and implementors.
Copy link
Member

Choose a reason for hiding this comment

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

The doc comment needs to be fixed. It's mixed together with above.

Copy link
Member Author

Choose a reason for hiding this comment

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

It is likely due to resolving merge conflicts. Will fix.

Copy link
Contributor

@tabVersion tabVersion left a comment

Choose a reason for hiding this comment

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

Let's bench

@@ -312,7 +308,10 @@ where
Err(create_error())?;
}

options.convert_to_datum(value, type_expected)
// TODO: may borrow the value directly
Copy link
Member Author

Choose a reason for hiding this comment

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

Will address in #17171.

Comment on lines 59 to 62
/// Similar to `access`, but may return a borrowed [`DatumCow::Borrowed`] to avoid unnecessary allocation.
/// If not overridden, it will call forward to `access` and always wrap the result in [`DatumCow::Owned`].
///
/// This should be preferred over `access` for both callers and implementors.
Copy link
Member Author

Choose a reason for hiding this comment

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

It is likely due to resolving merge conflicts. Will fix.

Base automatically changed from bz/parser-perf-2 to main June 10, 2024 05:21
Signed-off-by: Bugen Zhao <[email protected]>
Copy link
Member Author

Merge activity

  • Jun 10, 1:22 AM EDT: Graphite rebased this pull request after merging its parent, because this pull request is set to merge when ready.

@BugenZhao BugenZhao enabled auto-merge June 10, 2024 05:30
@BugenZhao BugenZhao added this pull request to the merge queue Jun 10, 2024
Merged via the queue into main with commit 9e137fc Jun 10, 2024
29 of 30 checks passed
@BugenZhao BugenZhao deleted the bz/parser-perf-3 branch June 10, 2024 05:48
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.

3 participants