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(error): eliminate RwError usages in batch #13557

Merged
merged 6 commits into from
Nov 21, 2023
Merged

Conversation

BugenZhao
Copy link
Member

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

What's changed and what's your intention?

#4077. Close #4368.

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.

Signed-off-by: Bugen Zhao <[email protected]>
Signed-off-by: Bugen Zhao <[email protected]>
Signed-off-by: Bugen Zhao <[email protected]>
@BugenZhao BugenZhao requested a review from a team as a code owner November 21, 2023 08:52
@stdrc stdrc self-requested a review November 21, 2023 08:55
Copy link
Contributor

@wangrunji0408 wangrunji0408 left a comment

Choose a reason for hiding this comment

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

LGTM!

Comment on lines +105 to +110
#[error(transparent)]
Shared(
#[from]
#[backtrace]
Arc<Self>,
),
Copy link
Member

Choose a reason for hiding this comment

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

What is this Shared for? Perhaps need some comments

Okay, it means Arc 😄

src/batch/src/error.rs Outdated Show resolved Hide resolved
#[backtrace]
BoxedError,
),

#[error("Failed to send result to channel")]
SenderError,
Copy link
Member

Choose a reason for hiding this comment

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

The source error is dropped. Is this intended?

Copy link
Member Author

Choose a reason for hiding this comment

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

I believe so. The error variant of channel sending result is for retrieving the ownership of the item back to the caller, which I think is not that meaningful here.

Copy link
Member

Choose a reason for hiding this comment

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

Just checked UnsupportedFunction and found there is only 1 use case for it, furthurmore, I think that should be a panic instead of error.

return Err(BatchError::UnsupportedFunction(
"The concatenate behaviour of two chunk with visibility is undefined".to_string(),
));

@fuyufjh
Copy link
Member

fuyufjh commented Nov 21, 2023

Thanks for the work! 🥰

Copy link
Member

@stdrc stdrc left a comment

Choose a reason for hiding this comment

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

Rest LGTM

Self::Serde(m.into())
}
}
impl From<ValueEncodingError> for BatchError {
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
impl From<ValueEncodingError> for BatchError {
impl From<ValueEncodingError> for BatchError {

Copy link
Member Author

Choose a reason for hiding this comment

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

I intended compact them since they're in the same group. 😰

Comment on lines 178 to 180
return Err(BatchError::Internal(anyhow!(
"Only support insert op in batch source executor"
))));
)));
Copy link
Member

Choose a reason for hiding this comment

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

Can we bail! here?

use crate::task::channel::{ChanReceiver, ChanReceiverImpl, ChanSender, ChanSenderImpl};
use crate::task::data_chunk_in_channel::DataChunkInChannel;

#[derive(Clone)]
pub struct ConsistentHashShuffleSender {
senders: Vec<mpsc::Sender<BatchSharedResult<Option<DataChunkInChannel>>>>,
senders: Vec<mpsc::Sender<SharedResult<Option<DataChunkInChannel>>>>,
Copy link
Member

Choose a reason for hiding this comment

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

What's the meaning of Shared?

Copy link
Member

Choose a reason for hiding this comment

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

Means Arc? 🤣 Prefer to just call it "Arc"

Copy link

codecov bot commented Nov 21, 2023

Codecov Report

Attention: 68 lines in your changes are missing coverage. Please review.

Comparison is base (ed957e6) 68.44% compared to head (2ce45cc) 68.37%.
Report is 11 commits behind head on main.

Files Patch % Lines
src/batch/src/task/task_execution.rs 16.66% 15 Missing ⚠️
src/batch/src/error.rs 6.66% 14 Missing ⚠️
src/batch/src/executor/join/local_lookup_join.rs 0.00% 9 Missing ⚠️
src/batch/src/executor/join/nested_loop_join.rs 25.00% 3 Missing ⚠️
src/batch/src/executor/source.rs 0.00% 3 Missing ⚠️
src/batch/src/executor/sort_over_window.rs 0.00% 2 Missing ⚠️
src/batch/src/executor/test_utils.rs 33.33% 2 Missing ⚠️
src/batch/src/task/channel.rs 33.33% 2 Missing ⚠️
src/batch/src/task/task_manager.rs 80.00% 2 Missing ⚠️
src/batch/src/executor/delete.rs 0.00% 1 Missing ⚠️
... and 15 more
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #13557      +/-   ##
==========================================
- Coverage   68.44%   68.37%   -0.08%     
==========================================
  Files        1511     1511              
  Lines      259862   259852      -10     
==========================================
- Hits       177856   177663     -193     
- Misses      82006    82189     +183     
Flag Coverage Δ
rust 68.37% <37.03%> (-0.08%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Signed-off-by: Bugen Zhao <[email protected]>
Signed-off-by: Bugen Zhao <[email protected]>
@BugenZhao BugenZhao added this pull request to the merge queue Nov 21, 2023
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Nov 21, 2023
@fuyufjh fuyufjh added this pull request to the merge queue Nov 21, 2023
Merged via the queue into main with commit b1e525a Nov 21, 2023
7 of 8 checks passed
@fuyufjh fuyufjh deleted the bz/error-rw-batch branch November 21, 2023 17:19
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.

batch: eliminate usages of RwError
4 participants