datafusion_spark/function/datetime/
mod.rs1pub mod date_add;
19pub mod date_sub;
20pub mod last_day;
21pub mod next_day;
22
23use datafusion_expr::ScalarUDF;
24use datafusion_functions::make_udf_function;
25use std::sync::Arc;
26
27make_udf_function!(date_add::SparkDateAdd, date_add);
28make_udf_function!(date_sub::SparkDateSub, date_sub);
29make_udf_function!(last_day::SparkLastDay, last_day);
30make_udf_function!(next_day::SparkNextDay, next_day);
31
32pub mod expr_fn {
33 use datafusion_functions::export_functions;
34
35 export_functions!((
36 date_add,
37 "Returns the date that is days days after start. The function returns NULL if at least one of the input parameters is NULL.",
38 arg1 arg2
39 ));
40 export_functions!((
41 date_sub,
42 "Returns the date that is days days before start. The function returns NULL if at least one of the input parameters is NULL.",
43 arg1 arg2
44 ));
45 export_functions!((
46 last_day,
47 "Returns the last day of the month which the date belongs to.",
48 arg1
49 ));
50 export_functions!((
53 next_day,
54 "Returns the first date which is later than start_date and named as indicated. The function returns NULL if at least one of the input parameters is NULL.",
55 arg1 arg2
56 ));
57}
58
59pub fn functions() -> Vec<Arc<ScalarUDF>> {
60 vec![date_add(), date_sub(), last_day(), next_day()]
61}