alamb opened a new issue, #11358:
URL: https://github.com/apache/datafusion/issues/11358

   ### Is your feature request related to a problem or challenge?
   
   The actual need is implementing `date_bin` that correctly bins dates on 
timezone correct timestamps (e.g. not UTC) as described by @Abdullahsab3 in  
https://github.com/apache/datafusion/issues/10368
   
   This ticket tracks adding the `to_local_time` function portion of 
@Abdullahsab3 's suggestion in DataFusion while we work on getting consensus if 
we want to change the semantics of the arrow cast kernel: 
https://github.com/apache/arrow-rs/pull/5826
   
   ### Describe the solution you'd like
   
   Add  function to_local_time that takes a timestamp/column as an argument, 
and a timezone as another argument. For example
   
   ```sql
   > select to_local_time('2020-11-30T08:00:00.000Z'::timestamp, 
'Europe/Brussels');
   -- translates to '2020-11-30T08:00:00.000Z'::timestamp + interval '1 hour'
   < '2020-11-30T09:00:00'
   ```
   The difference between this and the at time zone operator is:
   The at time zone operator seems to be only adding timezone/offset 
information to the timestamp if I understood correctly. the proposed 
to_local_time function should ideally apply that offset to the provided 
timestamp. The same example above would be:
   
   ```sql
   > select '2020-11-30T08:00:00.000Z'::timestamp at time zone 
'Europe/Brussels';
   +----------------------------------+
   | Utf8("2020-11-30T08:00:00.000Z") |
   +----------------------------------+
   | 2020-11-30T08:00:00+01:00        |
   +----------------------------------+
   1 row in set. Query took 0.002 seconds.
   ```
   
   ### Describe alternatives you've considered
   
   _No response_
   
   ### Additional context
   
   _No response_


-- 
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]

Reply via email to