[ 
https://issues.apache.org/jira/browse/CALCITE-5795?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Mihai Budiu resolved CALCITE-5795.
----------------------------------
    Resolution: Cannot Reproduce

Maybe this got fixed as a side-effect of some other changes?

> Type inference for VALUES with numeric values infers incorrect scale
> --------------------------------------------------------------------
>
>                 Key: CALCITE-5795
>                 URL: https://issues.apache.org/jira/browse/CALCITE-5795
>             Project: Calcite
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 1.34.0, 1.35.0
>            Reporter: Mihai Budiu
>            Priority: Minor
>
> Consider this query (using the Babel parser for the :: cast notation from 
> Postgres)
> {code:sql}
> WITH v(x) AS (VALUES(0::numeric),(4.2)) SELECT x FROM v as v1(x)
> {code}
> Calcite simplifies this to 0, 4, simplified at compilation time.
> However, Postgres returns 0, 4.2, as expected.
> It seems that this happens because the type inference for VALUES infers a 
> scale of 0.
> Note that the following variants of the query give correct results:
> {code:sql}
> WITH v(x) AS (VALUES(0::numeric),(4.2::numeric)) SELECT x FROM v as v1(x)
> WITH v(x) AS (VALUES(0),(4.2)) SELECT x FROM v as v1(x)
> {code}



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

Reply via email to