kosiew commented on code in PR #25161: URL: https://github.com/apache/datafusion/pull/25161#discussion_r3985862222
########## datafusion/sqllogictest/test_files/from_unixtime_timezone.slt: ########## @@ -0,0 +1,161 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +########## +## from_unixtime timezone tests +## +## https://github.com/apache/datafusion/issues/12892 +########## + +## Make sure we start from the default (unset) session time zone +statement ok +RESET datafusion.execution.time_zone + +## Test 1: session time zone unset -> timezone naive, as before +query TP +SELECT arrow_typeof(from_unixtime(1704110400)), from_unixtime(1704110400); +---- +Timestamp(s) 2024-01-01T12:00:00 + +## Test 2: fixed offset session time zone +statement ok +SET datafusion.execution.time_zone = '+08:00'; + +query TP +SELECT arrow_typeof(from_unixtime(1704110400)), from_unixtime(1704110400); +---- +Timestamp(s, "+08:00") 2024-01-01T20:00:00+08:00 + +## The reproducer from the issue: to_unixtime/from_unixtime must round trip +query I +SELECT to_unixtime(from_unixtime(1704110400)); +---- +1704110400 + +## Test 3: named IANA session time zone +statement ok +SET datafusion.execution.time_zone = 'America/Denver'; + +query TP Review Comment: Could we add an `America/Denver` summer-instant assertion here, for example using a date in July that renders with `-06:00`? The named-zone coverage currently only checks January at `-07:00`, so adding a summer case would make sure we are testing DST behavior rather than something that could also be satisfied by a fixed offset. This is non-blocking since Arrow already provides the timezone rendering behavior, but it would help make the SQL contract a bit more robust. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
