You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2021/07/06 16:29:33 UTC

[GitHub] [arrow-datafusion] alamb commented on issue #686: Specific timezone support for `to_timetamp*()`

alamb commented on issue #686:
URL: https://github.com/apache/arrow-datafusion/issues/686#issuecomment-874907741


   @velvia 
   
   > we have been using the output of None timestamps from DataFusion but we treat all our timestamps as UTC internally.
   
   FWIW this is what we do in IOx as well
   
   > The best solution I can think of would be for to_timestamp(...) to support a second, optional argument where the timezone can be specified. 
   
   I think a second optional argument for `to_timestamp` is a fine solution that would be backwards compatible and also allow for improvements going forward
   
   > For example, if I have data with a timezone of Some("UTC") the following fails due to incompatible types: WHERE timestamp_col > to_timestamp("2021-06-21T12:00Z") (because timestamp_col has Some(UTC) but to_timestamp returns None)
   
   I think a better solution would be for DataFusion to implement coercion rules between date/time/timestamp types. In your example of a timestamp_col with `Timestamp(Milliseconds, Some("UTC")`), then I would *like* DataFusion to handle
   
   ```
   WHERE timestamp_col > to_timestamp("2021-06-21T12:00Z")
   ```
   
   by adding the following cast (please forgive me the pseudo-SQL)
   
   ```
   WHERE timestamp_col > cast (to_timestamp("2021-06-21T12:00Z") as timestamp(UTC))
   ```
   
   


-- 
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-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org