Skip to content

Commit 5d37bab

Browse files
authored
chore: Remove usage of paste crate (#20946)
## Which issue does this PR close? <!-- We generally require a GitHub issue to be filed for all bug fixes and enhancements and this helps us generate change logs for our releases. You can link an issue to this PR using the GitHub syntax. For example `Closes #123` indicates that this PR will close issue #123. --> - Closes #20853 ## Rationale for this change <!-- Why are you proposing this change? If this is already explained clearly in the issue then this section is not needed. Explaining clearly why changes are proposed helps reviewers understand your changes and offer better suggestions for fixes. --> ## What changes are included in this PR? <!-- There is no need to duplicate the description in the issue here but it is sometimes worth providing a summary of the individual changes in this PR. --> ## Are these changes tested? <!-- We typically require tests for all PRs in order to: 1. Prevent the code from being accidentally broken by subsequent changes 2. Serve as another way to document the expected behavior of the code If tests are not included in your PR, please explain why (for example, are they covered by existing tests)? --> ## Are there any user-facing changes? <!-- If there are user-facing changes then we may require documentation to be updated before approving the PR. --> <!-- If there are any breaking changes to public APIs, please add the `api change` label. -->
1 parent c6f7145 commit 5d37bab

30 files changed

Lines changed: 912 additions & 754 deletions

File tree

.github/workflows/audit.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,4 +48,4 @@ jobs:
4848
- name: Run audit check
4949
# Note: you can ignore specific RUSTSEC issues using the `--ignore` flag ,for example:
5050
# run: cargo audit --ignore RUSTSEC-2026-0001
51-
run: cargo audit --ignore RUSTSEC-2024-0436 --ignore RUSTSEC-2024-0014
51+
run: cargo audit --ignore RUSTSEC-2024-0014

Cargo.lock

Lines changed: 0 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,6 @@ parquet = { version = "58.0.0", default-features = false, features = [
173173
"async",
174174
"object_store",
175175
] }
176-
paste = "1.0.15"
177176
pbjson = { version = "0.9.0" }
178177
pbjson-types = "0.9"
179178
# Should match arrow-flight's version of prost.

datafusion/common/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,6 @@ libc = "0.2.180"
8585
log = { workspace = true }
8686
object_store = { workspace = true, optional = true }
8787
parquet = { workspace = true, optional = true, default-features = true }
88-
paste = { workspace = true }
8988
recursive = { workspace = true, optional = true }
9089
sqlparser = { workspace = true, optional = true }
9190
tokio = { workspace = true }

datafusion/common/src/error.rs

Lines changed: 95 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -903,76 +903,125 @@ macro_rules! assert_ne_or_internal_err {
903903
/// plan_err!("Error {val:?}")
904904
///
905905
/// `NAME_ERR` - macro name for wrapping Err(DataFusionError::*)
906+
/// `PREFIXED_NAME_ERR` - underscore-prefixed alias for NAME_ERR (e.g., _plan_err)
907+
/// (Needed to avoid compiler error when using macro in the same crate: `macros from the current crate cannot be referred to by absolute paths`)
906908
/// `NAME_DF_ERR` - macro name for wrapping DataFusionError::*. Needed to keep backtrace opportunity
907909
/// in construction where DataFusionError::* used directly, like `map_err`, `ok_or_else`, etc
910+
/// `PREFIXED_NAME_DF_ERR` - underscore-prefixed alias for NAME_DF_ERR (e.g., _plan_datafusion_err).
911+
/// (Needed to avoid compiler error when using macro in the same crate: `macros from the current crate cannot be referred to by absolute paths`)
908912
macro_rules! make_error {
909-
($NAME_ERR:ident, $NAME_DF_ERR: ident, $ERR:ident) => { make_error!(@inner ($), $NAME_ERR, $NAME_DF_ERR, $ERR); };
910-
(@inner ($d:tt), $NAME_ERR:ident, $NAME_DF_ERR:ident, $ERR:ident) => {
911-
::paste::paste!{
912-
/// Macro wraps `$ERR` to add backtrace feature
913-
#[macro_export]
914-
macro_rules! $NAME_DF_ERR {
915-
($d($d args:expr),* $d(; diagnostic=$d DIAG:expr)?) => {{
916-
let err =$crate::DataFusionError::$ERR(
917-
::std::format!(
918-
"{}{}",
919-
::std::format!($d($d args),*),
920-
$crate::DataFusionError::get_back_trace(),
921-
).into()
922-
);
923-
$d (
924-
let err = err.with_diagnostic($d DIAG);
925-
)?
926-
err
927-
}
928-
}
913+
($NAME_ERR:ident, $PREFIXED_NAME_ERR:ident, $NAME_DF_ERR:ident, $PREFIXED_NAME_DF_ERR:ident, $ERR:ident) => {
914+
make_error!(@inner ($), $NAME_ERR, $PREFIXED_NAME_ERR, $NAME_DF_ERR, $PREFIXED_NAME_DF_ERR, $ERR);
915+
};
916+
(@inner ($d:tt), $NAME_ERR:ident, $PREFIXED_NAME_ERR:ident, $NAME_DF_ERR:ident, $PREFIXED_NAME_DF_ERR:ident, $ERR:ident) => {
917+
/// Macro wraps `$ERR` to add backtrace feature
918+
#[macro_export]
919+
macro_rules! $NAME_DF_ERR {
920+
($d($d args:expr),* $d(; diagnostic = $d DIAG:expr)?) => {{
921+
let err = $crate::DataFusionError::$ERR(
922+
::std::format!(
923+
"{}{}",
924+
::std::format!($d($d args),*),
925+
$crate::DataFusionError::get_back_trace(),
926+
).into()
927+
);
928+
$d (
929+
let err = err.with_diagnostic($d DIAG);
930+
)?
931+
err
932+
}}
929933
}
930934

931-
/// Macro wraps Err(`$ERR`) to add backtrace feature
932-
#[macro_export]
933-
macro_rules! $NAME_ERR {
934-
($d($d args:expr),* $d(; diagnostic = $d DIAG:expr)?) => {{
935-
let err = $crate::[<_ $NAME_DF_ERR>]!($d($d args),*);
936-
$d (
937-
let err = err.with_diagnostic($d DIAG);
938-
)?
939-
Err(err)
940-
941-
}}
942-
}
943-
944-
945-
#[doc(hidden)]
946-
pub use $NAME_ERR as [<_ $NAME_ERR>];
947-
#[doc(hidden)]
948-
pub use $NAME_DF_ERR as [<_ $NAME_DF_ERR>];
935+
/// Macro wraps Err(`$ERR`) to add backtrace feature
936+
#[macro_export]
937+
macro_rules! $NAME_ERR {
938+
($d($d args:expr),* $d(; diagnostic = $d DIAG:expr)?) => {{
939+
let err = $crate::$PREFIXED_NAME_DF_ERR!($d($d args),*);
940+
$d (
941+
let err = err.with_diagnostic($d DIAG);
942+
)?
943+
Err(err)
944+
}}
949945
}
946+
947+
#[doc(hidden)]
948+
pub use $NAME_ERR as $PREFIXED_NAME_ERR;
949+
#[doc(hidden)]
950+
pub use $NAME_DF_ERR as $PREFIXED_NAME_DF_ERR;
950951
};
951952
}
952953

953954
// Exposes a macro to create `DataFusionError::Plan` with optional backtrace
954-
make_error!(plan_err, plan_datafusion_err, Plan);
955+
make_error!(
956+
plan_err,
957+
_plan_err,
958+
plan_datafusion_err,
959+
_plan_datafusion_err,
960+
Plan
961+
);
955962

956963
// Exposes a macro to create `DataFusionError::Internal` with optional backtrace
957-
make_error!(internal_err, internal_datafusion_err, Internal);
964+
make_error!(
965+
internal_err,
966+
_internal_err,
967+
internal_datafusion_err,
968+
_internal_datafusion_err,
969+
Internal
970+
);
958971

959972
// Exposes a macro to create `DataFusionError::NotImplemented` with optional backtrace
960-
make_error!(not_impl_err, not_impl_datafusion_err, NotImplemented);
973+
make_error!(
974+
not_impl_err,
975+
_not_impl_err,
976+
not_impl_datafusion_err,
977+
_not_impl_datafusion_err,
978+
NotImplemented
979+
);
961980

962981
// Exposes a macro to create `DataFusionError::Execution` with optional backtrace
963-
make_error!(exec_err, exec_datafusion_err, Execution);
982+
make_error!(
983+
exec_err,
984+
_exec_err,
985+
exec_datafusion_err,
986+
_exec_datafusion_err,
987+
Execution
988+
);
964989

965990
// Exposes a macro to create `DataFusionError::Configuration` with optional backtrace
966-
make_error!(config_err, config_datafusion_err, Configuration);
991+
make_error!(
992+
config_err,
993+
_config_err,
994+
config_datafusion_err,
995+
_config_datafusion_err,
996+
Configuration
997+
);
967998

968999
// Exposes a macro to create `DataFusionError::Substrait` with optional backtrace
969-
make_error!(substrait_err, substrait_datafusion_err, Substrait);
1000+
make_error!(
1001+
substrait_err,
1002+
_substrait_err,
1003+
substrait_datafusion_err,
1004+
_substrait_datafusion_err,
1005+
Substrait
1006+
);
9701007

9711008
// Exposes a macro to create `DataFusionError::ResourcesExhausted` with optional backtrace
972-
make_error!(resources_err, resources_datafusion_err, ResourcesExhausted);
1009+
make_error!(
1010+
resources_err,
1011+
_resources_err,
1012+
resources_datafusion_err,
1013+
_resources_datafusion_err,
1014+
ResourcesExhausted
1015+
);
9731016

9741017
// Exposes a macro to create `DataFusionError::Ffi` with optional backtrace
975-
make_error!(ffi_err, ffi_datafusion_err, Ffi);
1018+
make_error!(
1019+
ffi_err,
1020+
_ffi_err,
1021+
ffi_datafusion_err,
1022+
_ffi_datafusion_err,
1023+
Ffi
1024+
);
9761025

9771026
// Exposes a macro to create `DataFusionError::SQL` with optional backtrace
9781027
#[macro_export]

datafusion/core/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,6 @@ bytes = { workspace = true }
172172
env_logger = { workspace = true }
173173
glob = { workspace = true }
174174
insta = { workspace = true }
175-
paste = { workspace = true }
176175
pretty_assertions = "1.0"
177176
rand = { workspace = true, features = ["small_rng"] }
178177
rand_distr = "0.5"

0 commit comments

Comments
 (0)