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

   **Is your feature request related to a problem or challenge? Please describe 
what you are trying to do.**
   DataFusion strives to be postgres compatible, so when there are differences 
between postgres and datafusion it is confusing
   
   Today, one argument form of to_timestamp works in datafusion:
   ```sql
   ❯ select to_timestamp('2014-05-11 01:07:34.779000+01:00');
   +-------------------------------------------------------+
   | totimestamp(Utf8("2014-05-11 01:07:34.779000+01:00")) |
   +-------------------------------------------------------+
   | 2014-05-11T00:07:34.779                               |
   +-------------------------------------------------------+
   1 row in set. Query took 0.000 seconds.
   ```
   
   But the 2 argument form does not:
   ```sql
   ❯  select to_timestamp('2014-05-11 01:07:34.779000+01:00', 'YYYY-MM-DD 
HH:MI:SS.NS');
   Plan("Coercion from [Utf8, Utf8] to the signature Uniform(1, [Int64, 
Timestamp(Nanosecond, None), Timestamp(Microsecond, None), 
Timestamp(Millisecond, None), Timestamp(Second, None), Utf8]) failed.")
   ```
   
   **Describe the solution you'd like**
   
   Implement the two argument form of `to_timestamp` as described in  
   
   https://www.postgresql.org/docs/current/functions-formatting.html
   
   > to_timestamp ( text, text ) → timestamp with time zone
   >
   > Converts string to time stamp according to the given format. (See also 
to_timestamp(double precision) in [Table 
9.33](https://www.postgresql.org/docs/current/functions-datetime.html#FUNCTIONS-DATETIME-TABLE).)
   
   ```sql
   postgres=# select to_timestamp('2014-05-11 01:07:34.779000+01:00', 
'YYYY-MM-DD HH:MI:SS.NS');
         to_timestamp
   ------------------------
    2014-05-11 01:07:34+00
   (1 row)
   ```
   
   **Describe alternatives you've considered**
   A clear and concise description of any alternative solutions or features 
you've considered.
   
   **Additional context**
   Thank you to @cannonpalms and @idclark


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