dhamotharan-ps commented on issue #8790:
URL:
https://github.com/apache/arrow-datafusion/issues/8790#issuecomment-1889421288
Without fix, the following are return types of coalesce() function.
```
create or replace table x as (
select
cast(null as timestamp) as n,
cast('2020-01-01T00:00:00Z' as timestamp) as v
);
select coalesce(n, v) from x; -- return datatype is Utf8
create or replace table x as (
select
cast(null as Decimal) as n,
cast(8 as BIGINT) as v
);
select coalesce(n, v) from x; -- return datatype is Float64
create or replace table x as (
select
cast(null as Date) as n,
cast('2020-01-01T00:00:00Z' as Timestamp) as v
);
select coalesce(n, v) from x; -- return datatype is Utf8
create or replace table x as (
select
cast(null as Bigint unsigned) as n,
cast(8 as BIGINT) as v
);
select coalesce(n, v) from x; -- return datatype is Float32
```
With fix,
```
create or replace table x as (
select
cast(null as timestamp) as n,
cast('2020-01-01T00:00:00Z' as timestamp) as v
);
select coalesce(n, v) from x; -- return datatype is
Timestamp(Nanosecond, None)
create or replace table x as (
select
cast(null as Decimal) as n,
cast(8 as BIGINT) as v
);
select coalesce(n, v) from x; -- return datatype is Decimal128(38, 10)
create or replace table x as (
select
cast(null as Date) as n,
cast('2020-01-01T00:00:00Z' as Timestamp) as v
);
select coalesce(n, v) from x; -- return datatype is Timestamp(Nanosecond,
None)
create or replace table x as (
select
cast(null as Bigint unsigned) as n,
cast(8 as BIGINT) as v
);
select coalesce(n, v) from x; -- return datatype is Int64
```
--
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]