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

   ### Describe the bug
   
   The `coalesce()` function when applied to two `Timestamp(_, _)` columns 
unexpectedly returns `Utf8` result.
   
   ### To Reproduce
   
   In `datafusion-cli`:
   ```
   create or replace table x as (
       select 
           cast(null as timestamp) as n, 
           cast('2020-01-01T00:00:00Z' as timestamp) as v
   );
   
   describe x;
   +-------------+-----------------------------+-------------+
   | column_name | data_type                   | is_nullable |
   +-------------+-----------------------------+-------------+
   | n           | Timestamp(Nanosecond, None) | YES         |
   | v           | Timestamp(Nanosecond, None) | NO          |
   +-------------+-----------------------------+-------------+
   
   select * from x;
   +---+---------------------+
   | n | v                   |
   +---+---------------------+
   |   | 2020-01-01T00:00:00 |
   +---+---------------------+
   
   create or replace table y as (
       select coalesce(n, v) as v from x
   );
   
   select * from y;
   +---------------------+
   | v                   |
   +---------------------+
   | 2020-01-01T00:00:00 |
   +---------------------+
   
   describe y;
   +-------------+-----------+-------------+
   | column_name | data_type | is_nullable |
   +-------------+-----------+-------------+
   | v           | Utf8      | YES         |
   +-------------+-----------+-------------+
   ```
   
   ### Expected behavior
   
   1) Result column is of `Timestamp` type
   2) Result column is NOT nullable, as one of the arguments to `coalesce()` 
cannot be NULL
   
   ### 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