-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Extend backtrace coverage for DatafusionError::Plan
errors errors
#7803
Conversation
datafusion/common/src/error.rs
Outdated
@@ -493,16 +500,16 @@ macro_rules! make_error { | |||
} | |||
|
|||
// Exposes a macro to create `DataFusionError::Plan` | |||
make_error!(plan_err, Plan); | |||
make_error!(plan_err, plan_err_raw, Plan); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was not able to invent better naming, appreciate if anyone helps
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe plan_err_obj
or plan_datafusion_error
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good 👍 (did't come up with a better naming)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @comphead -- this looks like an improvement to me. I left some suggestions on how to improve the documentation that I think would be valuable, and some alternative names for your consideration
datafusion/common/src/error.rs
Outdated
@@ -478,9 +478,16 @@ macro_rules! with_dollar_sign { | |||
/// plan_err!("Error {val}") | |||
/// plan_err!("Error {val:?}") | |||
macro_rules! make_error { | |||
($NAME:ident, $ERR:ident) => { | |||
($NAME:ident, $NAME_RAW: ident, $ERR:ident) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please document in comments what $NAME
and $NAME_RAW
are and how they are different?
my reading is that the raw
is the name of an internal macro that gets generated. I think it would help to document more clearly what the difference in plan_err!
and plan_err_raw!
did (specifically that plan_err
returns an Err(plan_err_raw)
datafusion/common/src/error.rs
Outdated
@@ -493,16 +500,16 @@ macro_rules! make_error { | |||
} | |||
|
|||
// Exposes a macro to create `DataFusionError::Plan` | |||
make_error!(plan_err, Plan); | |||
make_error!(plan_err, plan_err_raw, Plan); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe plan_err_obj
or plan_datafusion_error
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks again @comphead
@@ -477,12 +477,25 @@ macro_rules! with_dollar_sign { | |||
/// plan_err!("Error {:?}", val) | |||
/// plan_err!("Error {val}") | |||
/// plan_err!("Error {val:?}") | |||
/// | |||
/// `NAME_ERR` - macro name for wrapping Err(DataFusionError::*) | |||
/// `NAME_DF_ERR` - macro name for wrapping DataFusionError::*. Needed to keep backtrace opportunity |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
Which issue does this PR close?
Closes #7818
The PR improves backtrace coverage for
DatafusionError::Plan
errors, specifically for errors called inok_or_else
ormap_err
constructionsRationale for this change
Currently constructions
ok_or_else
ormap_err
using direct reference toDatafusionError::Plan
which makes impossible to backtrace them in case of tracing error for theResult<T, E>
. To improve the coverage one more error macros introducedplan_err_raw
(name discussible)What changes are included in this PR?
Are these changes tested?
Are there any user-facing changes?