You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@datafusion.apache.org by "coderfender (via GitHub)" <gi...@apache.org> on 2026/03/14 16:40:56 UTC
[PR] chore : deprecate_paste_crate [datafusion]
coderfender opened a new pull request, #20946:
URL: https://github.com/apache/datafusion/pull/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.
-->
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] chore: Deprecate usage of paste crate [datafusion]
Posted by "coderfender (via GitHub)" <gi...@apache.org>.
coderfender commented on PR #20946:
URL: https://github.com/apache/datafusion/pull/20946#issuecomment-4060975891
Fixed a typo `simple_udfw` instead of `simple_udwf`
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] chore : deprecate_paste_crate [datafusion]
Posted by "coderfender (via GitHub)" <gi...@apache.org>.
coderfender commented on PR #20946:
URL: https://github.com/apache/datafusion/pull/20946#issuecomment-4060855370
TODO : Deprecate paste crate usage in `error.rs`
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] chore: Remove usage of `paste` crate [datafusion]
Posted by "comphead (via GitHub)" <gi...@apache.org>.
comphead commented on PR #20946:
URL: https://github.com/apache/datafusion/pull/20946#issuecomment-4070466062
Thanks @coderfender and @martin-g
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] chore: Remove usage of `paste` crate [datafusion]
Posted by "comphead (via GitHub)" <gi...@apache.org>.
comphead commented on code in PR #20946:
URL: https://github.com/apache/datafusion/pull/20946#discussion_r2942643790
##########
datafusion/common/src/error.rs:
##########
@@ -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)
Review Comment:
```suggestion
/// `PREFIXED_NAME_ERR` - underscore-prefixed alias for NAME_ERR (e.g., _plan_err). Needed to avoid compiler error when using macro in the same crate: `macros from the current crate cannot be referred to by absolute paths`
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] chore: Remove usage of `paste` crate [datafusion]
Posted by "comphead (via GitHub)" <gi...@apache.org>.
comphead commented on code in PR #20946:
URL: https://github.com/apache/datafusion/pull/20946#discussion_r2942645163
##########
datafusion/common/src/error.rs:
##########
@@ -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)
/// `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)
Review Comment:
```suggestion
/// `PREFIXED_NAME_DF_ERR` - underscore-prefixed alias for NAME_DF_ERR (e.g., _plan_datafusion_err). Needed to avoid compiler error when using macro in the same crate: `macros from the current crate cannot be referred to by absolute paths`
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] chore: Remove usage of `paste` crate [datafusion]
Posted by "comphead (via GitHub)" <gi...@apache.org>.
comphead merged PR #20946:
URL: https://github.com/apache/datafusion/pull/20946
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] chore: Remove usage of `paste` crate [datafusion]
Posted by "coderfender (via GitHub)" <gi...@apache.org>.
coderfender commented on PR #20946:
URL: https://github.com/apache/datafusion/pull/20946#issuecomment-4070304125
@comphead , done . I added the comments in macro def per your review
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] chore: deprecate_paste_crate [datafusion]
Posted by "coderfender (via GitHub)" <gi...@apache.org>.
coderfender commented on PR #20946:
URL: https://github.com/apache/datafusion/pull/20946#issuecomment-4060909997
@martin-g , ready for your review
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] chore: Remove usage of `paste` crate [datafusion]
Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb commented on PR #20946:
URL: https://github.com/apache/datafusion/pull/20946#issuecomment-4070040324
this looks great -- thank you @coderfender and @martin-g.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] chore: deprecate_paste_crate [datafusion]
Posted by "coderfender (via GitHub)" <gi...@apache.org>.
coderfender commented on PR #20946:
URL: https://github.com/apache/datafusion/pull/20946#issuecomment-4060914370
@comphead , I took the more laborious approach to remove paste crate and replace the macro defs with elaborated arguments than trying to find a new package. Almost all other past crate usage is in tests / non critical path of code with one major usage in UDWF and Error macros
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] chore: Deprecate usage of paste crate [datafusion]
Posted by "coderfender (via GitHub)" <gi...@apache.org>.
coderfender commented on PR #20946:
URL: https://github.com/apache/datafusion/pull/20946#issuecomment-4063736946
Thank you for the review @martin-g . Fixed the typo with `udfw` in the docs aignature and fixed macro signature docs per review comments. Take a look whenever you get a chance . Thank you
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] chore: Remove usage of `paste` crate [datafusion]
Posted by "coderfender (via GitHub)" <gi...@apache.org>.
coderfender commented on PR #20946:
URL: https://github.com/apache/datafusion/pull/20946#issuecomment-4070045712
Thank you @alamb
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] chore: Deprecate usage of paste crate [datafusion]
Posted by "martin-g (via GitHub)" <gi...@apache.org>.
martin-g commented on code in PR #20946:
URL: https://github.com/apache/datafusion/pull/20946#discussion_r2936412914
##########
datafusion/functions-window/src/macros.rs:
##########
@@ -221,7 +222,7 @@ macro_rules! get_or_init_udwf {
/// # use datafusion_expr::{col, lit};
/// # use datafusion_functions_window_common::partition::PartitionEvaluatorArgs;
/// #
-/// # get_or_init_udwf!(Lead, lead, "user-defined window function");
+/// # get_or_init_udwf!(Lead, lead,lead_udfw, "user-defined window function");
Review Comment:
```suggestion
/// # get_or_init_udwf!(Lead, lead,lead_udwf, "user-defined window function");
```
##########
datafusion/functions-window/src/lib.rs:
##########
@@ -68,7 +68,7 @@ pub mod expr_fn {
/// Returns all default window functions
pub fn all_default_window_functions() -> Vec<Arc<WindowUDF>> {
vec![
- cume_dist::cume_dist_udwf(),
+ cume_dist::cume_dist_udfw(),
Review Comment:
```suggestion
cume_dist::cume_dist_udwf(),
```
##########
datafusion/functions-window/src/macros.rs:
##########
Review Comment:
misses the `$UDWF_FN` argument
##########
datafusion/common/src/error.rs:
##########
@@ -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)
/// `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)
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)?) => {{
Review Comment:
```suggestion
($d($d args:expr),* $d(; diagnostic = $d DIAG:expr)?) => {{
```
for consistency with the other macros
##########
datafusion/functions-table/src/lib.rs:
##########
Review Comment:
Please add an arg for `$func_name`
##########
datafusion/functions-window/src/cume_dist.rs:
##########
@@ -39,6 +39,7 @@ use std::sync::Arc;
define_udwf_and_expr!(
CumeDist,
cume_dist,
+ cume_dist_udfw,
Review Comment:
```suggestion
cume_dist_udwf,
```
##########
datafusion/functions-window/src/macros.rs:
##########
Review Comment:
misses the `$UDWF_FN` argument
##########
datafusion/functions-window/src/macros.rs:
##########
@@ -30,8 +30,8 @@
///
/// * `$UDWF`: The struct which defines the [`Signature`](datafusion_expr::Signature)
/// of the user-defined window function.
-/// * `$OUT_FN_NAME`: The basename to generate a unique function name like
-/// `$OUT_FN_NAME_udwf`.
+/// * `$OUT_FN_NAME`: The expression function name
+/// `$OUT_FN_NAME_udwf` : The unique function name
Review Comment:
```suggestion
/// `$UDWF_FN` : ...
```
##########
datafusion/functions-window/src/macros.rs:
##########
Review Comment:
misses the `$UDWF_FN` argument
##########
datafusion/functions-window/src/macros.rs:
##########
Review Comment:
misses the `$UDWF_FN` argument
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] chore: Deprecate usage of paste crate [datafusion]
Posted by "comphead (via GitHub)" <gi...@apache.org>.
comphead commented on PR #20946:
URL: https://github.com/apache/datafusion/pull/20946#issuecomment-4069455476
we would also need to rollback https://github.com/apache/datafusion/pull/20850
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] chore: Deprecate usage of paste crate [datafusion]
Posted by "coderfender (via GitHub)" <gi...@apache.org>.
coderfender commented on PR #20946:
URL: https://github.com/apache/datafusion/pull/20946#issuecomment-4069908184
@comphead , thank you for the review. I was wondering if we could do it in a different PR but I believe we can do it in the current PR too. I just pushed a commit to unignore the rust warning in git wf. Please take a look whenever you get a chance
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] chore: Remove usage of `paste` crate [datafusion]
Posted by "coderfender (via GitHub)" <gi...@apache.org>.
coderfender commented on PR #20946:
URL: https://github.com/apache/datafusion/pull/20946#issuecomment-4070249543
Let me address the comments @comphead
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org