Skip to content

Commit 118f1ed

Browse files
committed
feat: to_time function
1 parent 10db6b3 commit 118f1ed

File tree

4 files changed

+585
-0
lines changed

4 files changed

+585
-0
lines changed

datafusion/functions/src/datetime/mod.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ pub mod planner;
3535
pub mod to_char;
3636
pub mod to_date;
3737
pub mod to_local_time;
38+
pub mod to_time;
3839
pub mod to_timestamp;
3940
pub mod to_unixtime;
4041

@@ -50,6 +51,7 @@ make_udf_function!(from_unixtime::FromUnixtimeFunc, from_unixtime);
5051
make_udf_function!(to_char::ToCharFunc, to_char);
5152
make_udf_function!(to_date::ToDateFunc, to_date);
5253
make_udf_function!(to_local_time::ToLocalTimeFunc, to_local_time);
54+
make_udf_function!(to_time::ToTimeFunc, to_time);
5355
make_udf_function!(to_unixtime::ToUnixtimeFunc, to_unixtime);
5456
make_udf_function!(to_timestamp::ToTimestampFunc, to_timestamp);
5557
make_udf_function!(to_timestamp::ToTimestampSecondsFunc, to_timestamp_seconds);
@@ -110,6 +112,10 @@ pub mod expr_fn {
110112
to_unixtime,
111113
"converts a value to seconds since the unix epoch",
112114
args,
115+
),(
116+
to_time,
117+
"converts a string and optional formats to a `Time64(Nanoseconds)`",
118+
args,
113119
),(
114120
to_timestamp,
115121
"converts a string and optional formats to a `Timestamp(Nanoseconds, None)`",
@@ -278,6 +284,7 @@ pub fn functions() -> Vec<Arc<ScalarUDF>> {
278284
to_char(),
279285
to_date(),
280286
to_local_time(),
287+
to_time(),
281288
to_unixtime(),
282289
to_timestamp(),
283290
to_timestamp_seconds(),

0 commit comments

Comments
 (0)