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(array): introduce ArrayError & unify ensure! by anyhow! #3130

Merged
merged 6 commits into from
Jun 10, 2022

Conversation

BugenZhao
Copy link
Member

@BugenZhao BugenZhao commented Jun 10, 2022

What's changed and what's your intention?

This PR introduces ArrayError, and unifies the ensure macro by using anyhow! everywhere so that it can work under any context including RwError, ArrayError, and ExprError.

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)

Signed-off-by: Bugen Zhao <i@bugenzhao.com>
Signed-off-by: Bugen Zhao <i@bugenzhao.com>
Signed-off-by: Bugen Zhao <i@bugenzhao.com>
Signed-off-by: Bugen Zhao <i@bugenzhao.com>
Signed-off-by: Bugen Zhao <i@bugenzhao.com>
@codecov
Copy link

codecov bot commented Jun 10, 2022

Codecov Report

Merging #3130 (baec1cd) into main (ea9612c) will increase coverage by 0.01%.
The diff coverage is 78.28%.

@@            Coverage Diff             @@
##             main    #3130      +/-   ##
==========================================
+ Coverage   73.75%   73.76%   +0.01%     
==========================================
  Files         736      737       +1     
  Lines      101680   101611      -69     
==========================================
- Hits        74992    74955      -37     
+ Misses      26688    26656      -32     
Flag Coverage Δ
rust 73.76% <78.28%> (+0.01%) ⬆️

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

Impacted Files Coverage Δ
src/batch/src/executor/hash_agg.rs 89.87% <ø> (ø)
src/batch/src/executor/merge_sort_exchange.rs 72.32% <ø> (ø)
src/batch/src/executor/update.rs 82.27% <ø> (ø)
src/batch/src/executor/values.rs 97.67% <ø> (ø)
src/common/src/array/error.rs 0.00% <0.00%> (ø)
src/common/src/util/value_encoding/mod.rs 36.61% <0.00%> (ø)
src/expr/src/error.rs 25.00% <ø> (ø)
src/expr/src/lib.rs 100.00% <ø> (ø)
src/expr/src/vector_op/to_char.rs 0.00% <0.00%> (ø)
src/source/src/common.rs 0.00% <0.00%> (ø)
... and 59 more

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

@BugenZhao BugenZhao changed the title refactor(array): introduce ArrayError refactor(array): introduce ArrayError & unify ensure! by anyhow! Jun 10, 2022
@TennyZhuang TennyZhuang merged commit 36d4930 into main Jun 10, 2022
@TennyZhuang TennyZhuang deleted the bz/introduce-array-error branch June 10, 2022 11:55
Copy link
Contributor

@skyzh skyzh left a comment

Choose a reason for hiding this comment

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

ArrayError's Debug impl could be modified to print backtrace, so that we can diagnose error more easily in the future.

fn read(buf: &[u8]) -> ArrayResult<Decimal> {
match Decimal::from_str(Utf8ValueReader::read(buf)?) {
Ok(d) => Ok(d),
Err(e) => bail!("failed to read decimal from string: {}", e),
Copy link
Contributor

Choose a reason for hiding this comment

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

It would be better to use anyhow's context function to attach extra info to an existing error.

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 ArrayError Type
3 participants