comphead commented on code in PR #7732:
URL: https://github.com/apache/arrow-datafusion/pull/7732#discussion_r1346065716
##########
datafusion/expr/src/expr_fn.rs:
##########
@@ -103,6 +105,50 @@ pub fn or(left: Expr, right: Expr) -> Expr {
))
}
+// There is a solid implementation elsewhere. We are going to wrap it up as a
function.
+macro_rules! naive_unary_fn_impl {
+ ($func:ident, $doc:expr) => {
+ #[doc = $doc]
+ pub fn $func(expr: Expr) -> Expr {
+ expr.$func()
+ }
+ };
+}
+
+macro_rules! naive_binary_fn_impl {
+ ($func:ident, $doc:expr) => {
+ #[doc = $doc]
+ pub fn $func(left: Expr, right: Expr) -> Expr {
+ left.$func(right)
+ }
+ };
+ ($func:ident, $from_func:ident, $doc:expr) => {
+ #[doc = $doc]
+ pub fn $func(left: Expr, right: Expr) -> Expr {
+ left.$from_func(right)
+ }
+ };
+}
+
+// Arithmetic expression
+naive_binary_fn_impl!(add, "Arithmetic addition");
+naive_binary_fn_impl!(sub, "Arithmetic subtraction");
+naive_binary_fn_impl!(mul, "Arithmetic multiplication");
+naive_binary_fn_impl!(div, "Arithmetic division");
+naive_binary_fn_impl!(r#mod, r#mod, "Arithmetic remainder");
Review Comment:
is it a typo? shouldn't be it
```
naive_binary_fn_impl!(r#mod, rem, "Arithmetic remainder");
```
--
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]