datafusion_spark/function/math/
mod.rs1pub mod expm1;
19pub mod factorial;
20pub mod hex;
21pub mod modulus;
22pub mod rint;
23pub mod width_bucket;
24
25use datafusion_expr::ScalarUDF;
26use datafusion_functions::make_udf_function;
27use std::sync::Arc;
28
29make_udf_function!(expm1::SparkExpm1, expm1);
30make_udf_function!(factorial::SparkFactorial, factorial);
31make_udf_function!(hex::SparkHex, hex);
32make_udf_function!(modulus::SparkMod, modulus);
33make_udf_function!(modulus::SparkPmod, pmod);
34make_udf_function!(rint::SparkRint, rint);
35make_udf_function!(width_bucket::SparkWidthBucket, width_bucket);
36
37pub mod expr_fn {
38 use datafusion_functions::export_functions;
39
40 export_functions!((expm1, "Returns exp(expr) - 1 as a Float64.", arg1));
41 export_functions!((
42 factorial,
43 "Returns the factorial of expr. expr is [0..20]. Otherwise, null.",
44 arg1
45 ));
46 export_functions!((hex, "Computes hex value of the given column.", arg1));
47 export_functions!((modulus, "Returns the remainder of division of the first argument by the second argument.", arg1 arg2));
48 export_functions!((pmod, "Returns the positive remainder of division of the first argument by the second argument.", arg1 arg2));
49 export_functions!((rint, "Returns the double value that is closest in value to the argument and is equal to a mathematical integer.", arg1));
50 export_functions!((width_bucket, "Returns the bucket number into which the value of this expression would fall after being evaluated.", arg1 arg2 arg3 arg4));
51}
52
53pub fn functions() -> Vec<Arc<ScalarUDF>> {
54 vec![
55 expm1(),
56 factorial(),
57 hex(),
58 modulus(),
59 pmod(),
60 rint(),
61 width_bucket(),
62 ]
63}