Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/audit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,4 @@ jobs:
- name: Run audit check
# Note: you can ignore specific RUSTSEC issues using the `--ignore` flag ,for example:
# run: cargo audit --ignore RUSTSEC-2026-0001
run: cargo audit --ignore RUSTSEC-2024-0436 --ignore RUSTSEC-2024-0014
run: cargo audit --ignore RUSTSEC-2024-0014
10 changes: 0 additions & 10 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,6 @@ parquet = { version = "58.0.0", default-features = false, features = [
"async",
"object_store",
] }
paste = "1.0.15"
pbjson = { version = "0.9.0" }
pbjson-types = "0.9"
# Should match arrow-flight's version of prost.
Expand Down
1 change: 0 additions & 1 deletion datafusion/common/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ libc = "0.2.180"
log = { workspace = true }
object_store = { workspace = true, optional = true }
parquet = { workspace = true, optional = true, default-features = true }
paste = { workspace = true }
recursive = { workspace = true, optional = true }
sqlparser = { workspace = true, optional = true }
tokio = { workspace = true }
Expand Down
139 changes: 93 additions & 46 deletions datafusion/common/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -903,76 +903,123 @@ macro_rules! assert_ne_or_internal_err {
/// plan_err!("Error {val:?}")
///
/// `NAME_ERR` - macro name for wrapping Err(DataFusionError::*)
/// `PREFIXED_NAME_ERR` - underscore-prefixed alias for NAME_ERR (e.g., _plan_err)
Comment thread
coderfender marked this conversation as resolved.
/// `NAME_DF_ERR` - macro name for wrapping DataFusionError::*. Needed to keep backtrace opportunity
/// in construction where DataFusionError::* used directly, like `map_err`, `ok_or_else`, etc
/// `PREFIXED_NAME_DF_ERR` - underscore-prefixed alias for NAME_DF_ERR (e.g., _plan_datafusion_err)
Comment thread
coderfender marked this conversation as resolved.
Outdated
macro_rules! make_error {
($NAME_ERR:ident, $NAME_DF_ERR: ident, $ERR:ident) => { make_error!(@inner ($), $NAME_ERR, $NAME_DF_ERR, $ERR); };
(@inner ($d:tt), $NAME_ERR:ident, $NAME_DF_ERR:ident, $ERR:ident) => {
::paste::paste!{
/// Macro wraps `$ERR` to add backtrace feature
#[macro_export]
macro_rules! $NAME_DF_ERR {
($d($d args:expr),* $d(; diagnostic=$d DIAG:expr)?) => {{
let err =$crate::DataFusionError::$ERR(
::std::format!(
"{}{}",
::std::format!($d($d args),*),
$crate::DataFusionError::get_back_trace(),
).into()
);
$d (
let err = err.with_diagnostic($d DIAG);
)?
err
}
}
($NAME_ERR:ident, $PREFIXED_NAME_ERR:ident, $NAME_DF_ERR:ident, $PREFIXED_NAME_DF_ERR:ident, $ERR:ident) => {
make_error!(@inner ($), $NAME_ERR, $PREFIXED_NAME_ERR, $NAME_DF_ERR, $PREFIXED_NAME_DF_ERR, $ERR);
};
(@inner ($d:tt), $NAME_ERR:ident, $PREFIXED_NAME_ERR:ident, $NAME_DF_ERR:ident, $PREFIXED_NAME_DF_ERR:ident, $ERR:ident) => {
/// Macro wraps `$ERR` to add backtrace feature
#[macro_export]
macro_rules! $NAME_DF_ERR {
($d($d args:expr),* $d(; diagnostic = $d DIAG:expr)?) => {{
let err = $crate::DataFusionError::$ERR(
::std::format!(
"{}{}",
::std::format!($d($d args),*),
$crate::DataFusionError::get_back_trace(),
).into()
);
$d (
let err = err.with_diagnostic($d DIAG);
)?
err
}}
}

/// Macro wraps Err(`$ERR`) to add backtrace feature
#[macro_export]
macro_rules! $NAME_ERR {
($d($d args:expr),* $d(; diagnostic = $d DIAG:expr)?) => {{
let err = $crate::[<_ $NAME_DF_ERR>]!($d($d args),*);
$d (
let err = err.with_diagnostic($d DIAG);
)?
Err(err)

}}
}


#[doc(hidden)]
pub use $NAME_ERR as [<_ $NAME_ERR>];
#[doc(hidden)]
pub use $NAME_DF_ERR as [<_ $NAME_DF_ERR>];
/// Macro wraps Err(`$ERR`) to add backtrace feature
#[macro_export]
macro_rules! $NAME_ERR {
($d($d args:expr),* $d(; diagnostic = $d DIAG:expr)?) => {{
let err = $crate::$PREFIXED_NAME_DF_ERR!($d($d args),*);
$d (
let err = err.with_diagnostic($d DIAG);
)?
Err(err)
}}
}

#[doc(hidden)]
pub use $NAME_ERR as $PREFIXED_NAME_ERR;
#[doc(hidden)]
pub use $NAME_DF_ERR as $PREFIXED_NAME_DF_ERR;
};
}

// Exposes a macro to create `DataFusionError::Plan` with optional backtrace
make_error!(plan_err, plan_datafusion_err, Plan);
make_error!(
plan_err,
_plan_err,
plan_datafusion_err,
_plan_datafusion_err,
Plan
);

// Exposes a macro to create `DataFusionError::Internal` with optional backtrace
make_error!(internal_err, internal_datafusion_err, Internal);
make_error!(
internal_err,
_internal_err,
internal_datafusion_err,
_internal_datafusion_err,
Internal
);

// Exposes a macro to create `DataFusionError::NotImplemented` with optional backtrace
make_error!(not_impl_err, not_impl_datafusion_err, NotImplemented);
make_error!(
not_impl_err,
_not_impl_err,
not_impl_datafusion_err,
_not_impl_datafusion_err,
NotImplemented
);

// Exposes a macro to create `DataFusionError::Execution` with optional backtrace
make_error!(exec_err, exec_datafusion_err, Execution);
make_error!(
exec_err,
_exec_err,
exec_datafusion_err,
_exec_datafusion_err,
Execution
);

// Exposes a macro to create `DataFusionError::Configuration` with optional backtrace
make_error!(config_err, config_datafusion_err, Configuration);
make_error!(
config_err,
_config_err,
config_datafusion_err,
_config_datafusion_err,
Configuration
);

// Exposes a macro to create `DataFusionError::Substrait` with optional backtrace
make_error!(substrait_err, substrait_datafusion_err, Substrait);
make_error!(
substrait_err,
_substrait_err,
substrait_datafusion_err,
_substrait_datafusion_err,
Substrait
);

// Exposes a macro to create `DataFusionError::ResourcesExhausted` with optional backtrace
make_error!(resources_err, resources_datafusion_err, ResourcesExhausted);
make_error!(
resources_err,
_resources_err,
resources_datafusion_err,
_resources_datafusion_err,
ResourcesExhausted
);

// Exposes a macro to create `DataFusionError::Ffi` with optional backtrace
make_error!(ffi_err, ffi_datafusion_err, Ffi);
make_error!(
ffi_err,
_ffi_err,
ffi_datafusion_err,
_ffi_datafusion_err,
Ffi
);

// Exposes a macro to create `DataFusionError::SQL` with optional backtrace
#[macro_export]
Expand Down
1 change: 0 additions & 1 deletion datafusion/core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,6 @@ bytes = { workspace = true }
env_logger = { workspace = true }
glob = { workspace = true }
insta = { workspace = true }
paste = { workspace = true }
pretty_assertions = "1.0"
rand = { workspace = true, features = ["small_rng"] }
rand_distr = "0.5"
Expand Down
Loading
Loading