alamb commented on issue #10602: URL: https://github.com/apache/datafusion/issues/10602#issuecomment-2122811703
The way you can perform this binning in postgres is somewhat paradoxically to convert a timestamp with a timezone back to a timestamp without timezone and then apply `date_bin`. The syntax to convert a timestamp to something without timezone is 🤯 : you apply `AT TIME ZONE` to a timestamp with a timezone and then it has no timezone) as @mhilton notes in https://github.com/apache/datafusion/issues/10368#issuecomment-2111684373 ```sql postgres=# select pg_typeof('2024-05-21T12:00:00'::timestamp AT TIME ZONE 'America/New_York'); pg_typeof -------------------------- timestamp with time zone (1 row) postgres=# select pg_typeof('2024-05-21T12:00:00'::timestamp AT TIME ZONE 'America/New_York' AT TIME ZONE 'Europe/Brussels' ); pg_typeof ----------------------------- timestamp without time zone. <-- WTF no timezone as the result of AT TIME ZONE (1 row) ``` -- 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: github-unsubscr...@datafusion.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org For additional commands, e-mail: github-h...@datafusion.apache.org