Sergey Nuyanzin created CALCITE-7499:
----------------------------------------
Summary: COALESCE doesn't take into account leastRestrictiveType
for input args
Key: CALCITE-7499
URL: https://issues.apache.org/jira/browse/CALCITE-7499
Project: Calcite
Issue Type: Bug
Components: core
Reporter: Sergey Nuyanzin
Assignee: Sergey Nuyanzin
In case {{COALESCE}} has at least 2 args as input of different types (e.g. INT
and BIGINT) like
{code:sql}
SELECT COALESCE(1, CAST(1 AS BIGINT));
{code}
it returns 1 as INT while {{leastRestrictiveType}} is BIGINT.
Similar issue for other types and for types with different precision.
Postgres takes into account types of input args
https://onecompiler.com/postgresql/44n48bnc8
also MySql https://onecompiler.com/mysql/44n4cgk4q
--
This message was sent by Atlassian Jira
(v8.20.10#820010)