jayzhan211 commented on code in PR #10700: URL: https://github.com/apache/datafusion/pull/10700#discussion_r1618187445
########## datafusion/functions/src/macros.rs: ########## @@ -59,6 +59,30 @@ macro_rules! export_functions { }; } +macro_rules! make_function { + // single vector argument (a single argument followed by a comma) + ($FUNC:ident, $DOC:expr, $arg:ident,) => { + #[doc = $DOC] + pub fn $FUNC($arg: Vec<datafusion_expr::Expr>) -> datafusion_expr::Expr { + super::$FUNC().call($arg) + } + }; + // variadic arguments (zero or more arguments, without commas) + ($FUNC:ident, $DOC:expr, $($arg:ident)*) => { + #[doc = $DOC] + pub fn $FUNC($($arg: datafusion_expr::Expr),*) -> datafusion_expr::Expr { + super::$FUNC().call(vec![$($arg),*]) + } + }; + // special to get_field function in datafusion/functions/src/core/mod.rs + ($FUNC:ident, $DOC:expr, $arg:ident, $arg2:ident) => { Review Comment: I don't agree to rewrite the second argument to Expr. I think we can remove it out of macro and define it specifically given it's specialty Use macro for general / trivial case only -- 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-unsubscr...@datafusion.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org For additional commands, e-mail: github-h...@datafusion.apache.org