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

   ### Describe the bug
   
   while i try to use `date_trunc` to `Timestamp(Second, None)`, it returns 
`Timestamp(Nanosecond, None)`
   
   ```bash
   ❯ select date_trunc('minute', to_timestamp_seconds(61));
   +---------------------------------------------------------+
   | datetrunc(Utf8("minute"),totimestampseconds(Int64(61))) |
   +---------------------------------------------------------+
   | 1970-01-01T00:01:00                                     |
   +---------------------------------------------------------+
   1 row in set. Query took 0.003 seconds.
   
   ❯ select arrow_typeof(date_trunc('minute', to_timestamp_seconds(61)));
   +----------------------------------------------------------------------+
   | arrowtypeof(datetrunc(Utf8("minute"),totimestampseconds(Int64(61)))) |
   +----------------------------------------------------------------------+
   | Timestamp(Nanosecond, None)                                          |
   +----------------------------------------------------------------------+
   1 row in set. Query took 0.003 seconds.
   ```
   
   The behavior is similar while I apply `date_trunc` to Timestamp with Millis 
and Micros.
   
   ### To Reproduce
   
   ```bash
   ❯ select arrow_typeof(date_trunc('minute', to_timestamp_seconds(61)));
   +----------------------------------------------------------------------+
   | arrowtypeof(datetrunc(Utf8("minute"),totimestampseconds(Int64(61)))) |
   +----------------------------------------------------------------------+
   | Timestamp(Nanosecond, None)                                          |
   +----------------------------------------------------------------------+
   1 row in set. Query took 0.003 seconds.
   ```
   
   ### Expected behavior
   
   ```bash
   ❯ select arrow_typeof(date_trunc('minute', to_timestamp_seconds(61)));
   +----------------------------------------------------------------------+
   | arrowtypeof(datetrunc(Utf8("minute"),totimestampseconds(Int64(61)))) |
   +----------------------------------------------------------------------+
   | Timestamp(Second, None)                                          |
   +----------------------------------------------------------------------+
   1 row in set. Query took 0.003 seconds.
   ```
   
   ### Additional context
   
   _No response_


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