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


   @adamhooper  here is what I had in mind in terms of values. Row 4 is also 
the most interesting, perhaps. I think this is consistent with what @westonpace 
has in his table
   
   | Example                                           | Output Arrow Type      
              |     Value
   | ------------------------------------------ | 
------------------------------------ | 
------------------------------------------------------
   | to_timestamp('1970-01-01')                 | `Timestamp(Nanoseconds, 
None)`       | 0
   | to_timestamp('1970-01-01+00:00')           | `Timestamp(Nanoseconds, 
None)`       | 0
   | to_timestamp('1970-01-01+01:00')           | `Timestamp(Nanoseconds, 
None)`       | -3600000000000 (1 hour of nanoseconds)
   | to_timestamp('1970-01-01', 'UTC')          | `Timestamp(Nanoseconds, Utc)` 
       | 5*3600000000000 (5 hour of nanoseconds) __assuming code was run on a 
computer set to EDT, UTC-5:00__
   | to_timestamp('1970-01-01+00:00', 'UTC')    | `Timestamp(Nanoseconds, Utc)` 
       | 0
   | to_timestamp('1970-01-01+01:00', 'UTC')    | `Timestamp(Nanoseconds, Utc)` 
       | -3600000000000 (1 hour of nanoseconds)
   
   
   > Does to_timestamp only accept offsets in the strings (e.g. +01:00 and not 
tzdata strings or things like MST)? For reference, ISO-8601 only deals with 
offsets.
   
   It handles a bunch of different formats (see 
[source](https://github.com/apache/arrow-datafusion/blob/master/datafusion/src/physical_plan/datetime_expressions.rs#L57-L63))
 but mostly trying to 
   ```
   /// Examples of accepted inputs:
   /// * `1997-01-31T09:26:56.123Z`        # RCF3339
   /// * `1997-01-31T09:26:56.123-05:00`   # RCF3339
   /// * `1997-01-31 09:26:56.123-05:00`   # close to RCF3339 but with a space 
rather than T
   /// * `1997-01-31T09:26:56.123`         # close to RCF3339 but no timezone 
offset specified
   /// * `1997-01-31 09:26:56.123`         # close to RCF3339 but uses a space 
and no timezone offset
   /// * `1997-01-31 09:26:56`             # close to RCF3339, no fractional 
seconds
   ```
   
   > Will Rust ever generate an Output Arrow Type with a time zone string (e.g. 
MST)?
   
   The Rust arrow implementation already can encode the timezone string but the 
support in compute kernels and datafusion for a timezone other than `None` is 
basically non existent
   
   However, in my mind the point of adding a second argument to `to_timestamp` 
is to allow the construction of output arrow types with timezone strings. The 
tz database has a rust wrapper which we may have to pull in 
https://github.com/chronotope/chrono-tz


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


Reply via email to