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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]