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(expr): introduce ExprError #3081

Merged
merged 5 commits into from
Jun 9, 2022
Merged

Conversation

TennyZhuang
Copy link
Contributor

@TennyZhuang TennyZhuang commented Jun 8, 2022

Signed-off-by: TennyZhuang [email protected]

What's changed and what's your intention?

PLEASE DO NOT LEAVE THIS EMPTY !!!

As title

Checklist

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

Refer to a related PR or issue link (optional)

close #3082

Signed-off-by: TennyZhuang <[email protected]>
@@ -96,6 +96,12 @@ pub enum ErrorCode {
#[source]
BoxedError,
),
#[error("Expr error: {0:?}")]
ExprError(
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm not sure should we introduce ExprError(ExprError) here instead of convert to other RwError.

Copy link
Member

Choose a reason for hiding this comment

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

pub type BoxedError = Box<dyn Error + Send + Sync>;

So there the error is boxed into a trait object. 🤔

ExprError(ExprError) looks better to me.

Copy link
Member

Choose a reason for hiding this comment

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

I think the expression error will always be capsulated by some other error like StreamError when exposed to the user, so there might be no need to make it a variant of RwError eventually.
We may keep it for now due to compatibility.

Copy link
Member

Choose a reason for hiding this comment

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

pub type BoxedError = Box<dyn Error + Send + Sync>;

So there the error is boxed into a trait object. 🤔

ExprError(ExprError) looks better to me.

It seems we can't refer ExprError here due to crate dependencies?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

pub type BoxedError = Box<dyn Error + Send + Sync>;

So there the error is boxed into a trait object. 🤔
ExprError(ExprError) looks better to me.

It seems we can't refer ExprError here due to crate dependencies?

Yes, same as StorageError

Signed-off-by: TennyZhuang <[email protected]>
Copy link
Contributor

@BowenXiao1999 BowenXiao1999 left a comment

Choose a reason for hiding this comment

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

LGTM!

Looking forward to it!

@codecov
Copy link

codecov bot commented Jun 9, 2022

Codecov Report

Merging #3081 (d9ad267) into main (77e07f0) will increase coverage by 0.05%.
The diff coverage is 83.54%.

@@            Coverage Diff             @@
##             main    #3081      +/-   ##
==========================================
+ Coverage   73.40%   73.46%   +0.05%     
==========================================
  Files         734      735       +1     
  Lines       99959    99930      -29     
==========================================
+ Hits        73376    73413      +37     
+ Misses      26583    26517      -66     
Flag Coverage Δ
rust 73.46% <83.54%> (+0.05%) ⬆️

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

Impacted Files Coverage Δ
src/batch/src/executor/project.rs 72.47% <0.00%> (ø)
src/batch/src/executor/update.rs 82.27% <0.00%> (ø)
src/batch/src/executor/values.rs 97.67% <0.00%> (+2.21%) ⬆️
src/common/src/error.rs 67.68% <0.00%> (-2.94%) ⬇️
src/expr/src/expr/expr_unary.rs 74.64% <0.00%> (+0.21%) ⬆️
src/expr/src/lib.rs 100.00% <ø> (ø)
src/expr/src/vector_op/conjunction.rs 100.00% <ø> (ø)
src/expr/src/vector_op/like.rs 95.12% <ø> (ø)
src/expr/src/vector_op/round.rs 100.00% <ø> (ø)
src/expr/src/vector_op/to_char.rs 0.00% <0.00%> (ø)
... and 46 more

📣 Codecov can now indicate which changes are the most critical in Pull Requests. Learn more

Copy link
Member

@fuyufjh fuyufjh left a comment

Choose a reason for hiding this comment

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

LGTM

@@ -96,6 +96,12 @@ pub enum ErrorCode {
#[source]
BoxedError,
),
#[error("Expr error: {0:?}")]
ExprError(
Copy link
Member

Choose a reason for hiding this comment

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

pub type BoxedError = Box<dyn Error + Send + Sync>;

So there the error is boxed into a trait object. 🤔

ExprError(ExprError) looks better to me.

Array(
#[backtrace]
#[source]
RwError,
Copy link
Member

Choose a reason for hiding this comment

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

Will we refactor this later?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes

@@ -256,7 +256,7 @@ mod tests {
Arc::new(input.into()),
&agg_type,
return_type,
ArrayBuilderImpl::Int32(I32ArrayBuilder::new(0)?),
ArrayBuilderImpl::Int32(I32ArrayBuilder::new(0).unwrap()),
Copy link
Member

Choose a reason for hiding this comment

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

Why ArrayBuilder::new returns Result...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Allocation may failed 😃

Copy link
Member

Choose a reason for hiding this comment

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

Anyway, here it's unwraped.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Here is tests

Copy link
Member

@BugenZhao BugenZhao left a comment

Choose a reason for hiding this comment

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

Cool!

@@ -96,6 +96,12 @@ pub enum ErrorCode {
#[source]
BoxedError,
),
#[error("Expr error: {0:?}")]
ExprError(
Copy link
Member

Choose a reason for hiding this comment

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

I think the expression error will always be capsulated by some other error like StreamError when exposed to the user, so there might be no need to make it a variant of RwError eventually.
We may keep it for now due to compatibility.

Comment on lines +43 to +45
#[backtrace]
#[source]
RwError,
Copy link
Member

Choose a reason for hiding this comment

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

May review this in the future. 🤣

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We need ArrayError :(

Signed-off-by: TennyZhuang <[email protected]>
@TennyZhuang TennyZhuang enabled auto-merge (squash) June 9, 2022 03:21
@TennyZhuang TennyZhuang merged commit b0a38c4 into main Jun 9, 2022
@TennyZhuang TennyZhuang deleted the refactor/introduce-expr-error branch June 9, 2022 03:30
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.

Introduce ExprError Type
4 participants