velox
velox copied to clipboard
Fix format_datetime to used linked TimeZone names
Summary: JODA has this concept of linked Time Zones where given a particular time zone ID, it will write out a different time zone ID when formatting a timestamp as a string (I suspect this is for historical reasons).
More information is available about this here https://github.com/JodaOrg/global-tz
This diff adds a script to parse the file JODA uses to get these links and turn it into a static map. I've done this for the file in the version of JODA Presto Java currently uses (there have been significant updates in more recent versions). Note that the file guarantees there are no transitive links so we don't need to handle that case.
I then updated the format_datetime UDF to use this mapping for the ZZZ (or more) pattern. It will use the linked time zone ID in place of the time zone ID if one is available.
This is also fixes casting TimestampWithTimeZone to Varchar which uses the same code path.
Differential Revision: D64870014