[
https://issues.apache.org/jira/browse/CALCITE-7499?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18078305#comment-18078305
]
Sergey Nuyanzin commented on CALCITE-7499:
------------------------------------------
thanks for the feedback
changed issue tittle
> COALESCE with args of different types might be simplified wrong
> ---------------------------------------------------------------
>
> 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
> Priority: Major
> Labels: pull-request-available
>
> 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)