waitingkuo commented on issue #3980:
URL: 
https://github.com/apache/arrow-datafusion/issues/3980#issuecomment-1294513044

   @alamb 
   
   datafusion currently returns `i32` which might lose some information, e.g.
   
   ```bash
   ❯ select date_part('second', timestamp '2000-01-01T00:00:00.1');
   +--------------------------------------------------------+
   | datepart(Utf8("second"),Utf8("2000-01-01T00:00:00.1")) |
   +--------------------------------------------------------+
   | 0                                                      |
   +--------------------------------------------------------+
   1 row in set. Query took 0.000 seconds.
   ```
   
   and 
   
   ```bash
   ❯ select extract(second from timestamp '2000-01-01T00:00:00.1');
   +--------------------------------------------------------+
   | datepart(Utf8("SECOND"),Utf8("2000-01-01T00:00:00.1")) |
   +--------------------------------------------------------+
   | 0                                                      |
   +--------------------------------------------------------+
   1 row in set. Query took 0.000 seconds.
   ```
   
   while postgresql has
   ```bash
   willy=# select date_part('second', timestamp '2000-01-01T00:00:00.1');
    date_part 
   -----------
          0.1
   (1 row)
   ```
   which returns double precision
   
   and
   
   ```bash
   willy=# select extract(second from timestamp '2000-01-01T00:00:00.1');
    extract  
   ----------
    0.100000
   (1 row)
   ```
   which returns decimal
   
   
   is it recommended to follow postgresql's return type?
   
   


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