This is an automated email from the ASF dual-hosted git repository.
alamb pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/datafusion.git
The following commit(s) were added to refs/heads/main by this push:
new 1c2a2fdcfe Fix an issue with to_char signature not working correctly
with timezones or other types because the ordering is not in most exact ->
least exact order. (#13126)
1c2a2fdcfe is described below
commit 1c2a2fdcfe4ebe49a1d8619a2429a3e691afa80c
Author: Bruce Ritchie <[email protected]>
AuthorDate: Tue Oct 29 07:38:10 2024 -0400
Fix an issue with to_char signature not working correctly with timezones or
other types because the ordering is not in most exact -> least exact order.
(#13126)
---
datafusion/functions/src/datetime/to_char.rs | 24 +++++++++++------------
datafusion/sqllogictest/test_files/timestamps.slt | 5 +++++
2 files changed, 17 insertions(+), 12 deletions(-)
diff --git a/datafusion/functions/src/datetime/to_char.rs
b/datafusion/functions/src/datetime/to_char.rs
index 2fbfb22611..f0c4a02c15 100644
--- a/datafusion/functions/src/datetime/to_char.rs
+++ b/datafusion/functions/src/datetime/to_char.rs
@@ -54,34 +54,34 @@ impl ToCharFunc {
vec![
Exact(vec![Date32, Utf8]),
Exact(vec![Date64, Utf8]),
+ Exact(vec![Time64(Nanosecond), Utf8]),
+ Exact(vec![Time64(Microsecond), Utf8]),
Exact(vec![Time32(Millisecond), Utf8]),
Exact(vec![Time32(Second), Utf8]),
- Exact(vec![Time64(Microsecond), Utf8]),
- Exact(vec![Time64(Nanosecond), Utf8]),
- Exact(vec![Timestamp(Second, None), Utf8]),
Exact(vec![
- Timestamp(Second, Some(TIMEZONE_WILDCARD.into())),
+ Timestamp(Nanosecond, Some(TIMEZONE_WILDCARD.into())),
Utf8,
]),
- Exact(vec![Timestamp(Millisecond, None), Utf8]),
+ Exact(vec![Timestamp(Nanosecond, None), Utf8]),
Exact(vec![
- Timestamp(Millisecond, Some(TIMEZONE_WILDCARD.into())),
+ Timestamp(Microsecond, Some(TIMEZONE_WILDCARD.into())),
Utf8,
]),
Exact(vec![Timestamp(Microsecond, None), Utf8]),
Exact(vec![
- Timestamp(Microsecond, Some(TIMEZONE_WILDCARD.into())),
+ Timestamp(Millisecond, Some(TIMEZONE_WILDCARD.into())),
Utf8,
]),
- Exact(vec![Timestamp(Nanosecond, None), Utf8]),
+ Exact(vec![Timestamp(Millisecond, None), Utf8]),
Exact(vec![
- Timestamp(Nanosecond, Some(TIMEZONE_WILDCARD.into())),
+ Timestamp(Second, Some(TIMEZONE_WILDCARD.into())),
Utf8,
]),
- Exact(vec![Duration(Second), Utf8]),
- Exact(vec![Duration(Millisecond), Utf8]),
- Exact(vec![Duration(Microsecond), Utf8]),
+ Exact(vec![Timestamp(Second, None), Utf8]),
Exact(vec![Duration(Nanosecond), Utf8]),
+ Exact(vec![Duration(Microsecond), Utf8]),
+ Exact(vec![Duration(Millisecond), Utf8]),
+ Exact(vec![Duration(Second), Utf8]),
],
Volatility::Immutable,
),
diff --git a/datafusion/sqllogictest/test_files/timestamps.slt
b/datafusion/sqllogictest/test_files/timestamps.slt
index d866ec8c94..38c2a66472 100644
--- a/datafusion/sqllogictest/test_files/timestamps.slt
+++ b/datafusion/sqllogictest/test_files/timestamps.slt
@@ -2780,6 +2780,11 @@ FROM
NULL
01:01:2025 23-59-58
+query T
+select to_char('2020-01-01 00:10:20.123'::timestamp at time zone
'America/New_York', '%Y-%m-%d %H:%M:%S.%3f');
+----
+2020-01-01 00:10:20.123
+
statement ok
drop table formats;
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]