You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ignite.apache.org by "Aleksey Plekhanov (Jira)" <ji...@apache.org> on 2022/12/23 13:10:00 UTC

[jira] [Commented] (IGNITE-18369) SQL. Incorrect inferred return type for functions for NUMERIC types

    [ https://issues.apache.org/jira/browse/IGNITE-18369?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17651658#comment-17651658 ] 

Aleksey Plekhanov commented on IGNITE-18369:
--------------------------------------------

Looks like correct return type for this query is {{{}VARCHAR{}}}, since {{COALESCE}} is converted to \{{CASE}}, and {{CASE}} infer return type according to this rule: least restreactive type for parameters, but if not found, wider type (see {{{}typeCoercion.getWiderTypeFor{}}}). For types {{FLOAT}} and {{VARCHAR}} wider is the second one.

> SQL. Incorrect inferred return type for functions  for NUMERIC types
> --------------------------------------------------------------------
>
>                 Key: IGNITE-18369
>                 URL: https://issues.apache.org/jira/browse/IGNITE-18369
>             Project: Ignite
>          Issue Type: Bug
>          Components: sql
>            Reporter: Yury Gerzhedovich
>            Priority: Major
>              Labels: calcite2-required, calcite3-required
>
> For functions takes numeric parameters return type is DECIMAL sintead of the same type as parameter.
> For example the following test is broken:
> {code:java}
> assertQuery("SELECT COALESCE(12.2, 'b')").withParams(12.2, "b").returns(12.2).check();{code}
> Result will be BigDecimal



--
This message was sent by Atlassian Jira
(v8.20.10#820010)