You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// Export the functions out of this package, both as expr_fn as well as a list of functions
42
-
export_functions!(
43
-
(nullif, arg_1 arg_2,"returns NULL if value1 equals value2; otherwise it returns value1. This can be used to perform the inverse operation of the COALESCE expression."),
44
-
(arrow_cast, arg_1 arg_2,"returns arg_1 cast to the `arrow_type` given the second argument. This can be used to cast to a specific `arrow_type`."),
45
-
(nvl, arg_1 arg_2,"returns value2 if value1 is NULL; otherwise it returns value1"),
46
-
(nvl2, arg_1 arg_2 arg_3,"Returns value2 if value1 is not NULL; otherwise, it returns value3."),
47
-
(arrow_typeof, arg_1,"Returns the Arrow type of the input expression."),
48
-
(r#struct, args,"Returns a struct with the given arguments"),
49
-
(named_struct, args,"Returns a struct with the given names and arguments pairs"),
50
-
(get_field, arg_1 arg_2,"Returns the value of the field with the given name from the struct"),
51
-
(coalesce, args,"Returns `coalesce(args...)`, which evaluates to the value of the first expr which is not NULL")
52
-
);
45
+
pubmod expr_fn {
46
+
use datafusion_expr::Expr;
47
+
48
+
/// returns NULL if value1 equals value2; otherwise it returns value1. This
49
+
/// can be used to perform the inverse operation of the COALESCE expression
50
+
pubfnnullif(arg1:Expr,arg2:Expr) -> Expr{
51
+
super::nullif().call(vec![arg1, arg2])
52
+
}
53
+
54
+
/// returns value1 cast to the `arrow_type` given the second argument. This
55
+
/// can be used to cast to a specific `arrow_type`.
56
+
pubfnarrow_cast(arg1:Expr,arg2:Expr) -> Expr{
57
+
super::arrow_cast().call(vec![arg1, arg2])
58
+
}
59
+
60
+
/// Returns value2 if value1 is NULL; otherwise it returns value1
61
+
pubfnnvl(arg1:Expr,arg2:Expr) -> Expr{
62
+
super::nvl().call(vec![arg1, arg2])
63
+
}
64
+
65
+
/// Returns value2 if value1 is not NULL; otherwise, it returns value3.
66
+
pubfnnvl2(arg1:Expr,arg2:Expr,arg3:Expr) -> Expr{
67
+
super::nvl2().call(vec![arg1, arg2, arg3])
68
+
}
69
+
70
+
/// Returns the Arrow type of the input expression.
71
+
pubfnarrow_typeof(arg1:Expr) -> Expr{
72
+
super::arrow_typeof().call(vec![arg1])
73
+
}
74
+
75
+
/// Returns a struct with the given arguments
76
+
pubfnr#struct(args:Vec<Expr>) -> Expr{
77
+
super::r#struct().call(args)
78
+
}
79
+
80
+
/// Returns a struct with the given names and arguments pairs
81
+
pubfnnamed_struct(args:Vec<Expr>) -> Expr{
82
+
super::named_struct().call(args)
83
+
}
84
+
85
+
/// Returns the value of the field with the given name from the struct
86
+
pubfnget_field(arg1:Expr,arg2:Expr) -> Expr{
87
+
super::get_field().call(vec![arg1, arg2])
88
+
}
89
+
90
+
/// Returns `coalesce(args...)`, which evaluates to the value of the first expr which is not NULL
91
+
pubfncoalesce(args:Vec<Expr>) -> Expr{
92
+
super::coalesce().call(args)
93
+
}
94
+
}
95
+
96
+
/// Return a list of all functions in this package
0 commit comments