Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Should Cast(UTF-8 AS Timestamp) apply local time zone? #3080

Open
Tracked by #8282 ...
waitingkuo opened this issue Aug 8, 2022 · 3 comments
Open
Tracked by #8282 ...

Should Cast(UTF-8 AS Timestamp) apply local time zone? #3080

waitingkuo opened this issue Aug 8, 2022 · 3 comments
Labels
enhancement New feature or request

Comments

@waitingkuo
Copy link
Contributor

waitingkuo commented Aug 8, 2022

Is your feature request related to a problem or challenge? Please describe what you are trying to do.

dataufusion v10.0.0's applies local time zone (i'm in UTC+8)

select cast('2000-01-01T00:00:00' as timestamp);
+------------------------------------------------------------------+
| CAST(Utf8("2000-01-01T00:00:00") AS Timestamp(Nanosecond, None)) |
+------------------------------------------------------------------+
| 1999-12-31 16:00:00                                              |
+------------------------------------------------------------------+
1 row in set. Query took 0.004 seconds.

while postgresql's is not

willy=# select cast('2000-01-01T00:00:00' as timestamp);
      timestamp      
---------------------
 2000-01-01 00:00:00
(1 row)

Describe the solution you'd like
A clear and concise description of what you want to happen.

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

Additional context
Add any other context or screenshots about the feature request here.

@waitingkuo
Copy link
Contributor Author

depends on apache/arrow-rs#1936

@alamb
Copy link
Contributor

alamb commented Oct 19, 2023

I wonder if this item is now complete

@waitingkuo
Copy link
Contributor Author

the original issue is fixed now

select '2000-01-01T00:00:00'::timestamp;
+-----------------------------+
| Utf8("2000-01-01T00:00:00") |
+-----------------------------+
| 2000-01-01T00:00:00         |
+-----------------------------+
1 row in set. Query took 0.002 seconds

however it's not yet totally aligned with postgrseql
datafusion

select '2000-01-01T00:00:00+01:00'::timestamp;
+-----------------------------------+
| Utf8("2000-01-01T00:00:00+01:00") |
+-----------------------------------+
| 1999-12-31T23:00:00               |
+-----------------------------------+
1 row in set. Query took 0.002 seconds.

postgresql

willy=# select '2000-01-01T00:00:00+01:00'::timestamp;
      timestamp      
---------------------
 2000-01-01 00:00:00
(1 row)

Looks like Postgresql's behavior is to completely ignore the timezone part while casting string to timestamp

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants