You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "Mihai Budiu (Jira)" <ji...@apache.org> on 2023/06/23 18:57:00 UTC
[jira] [Created] (CALCITE-5795) Type inference for VALUES with numeric values infers incorrect scale
Mihai Budiu created CALCITE-5795:
------------------------------------
Summary: 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
Reporter: Mihai Budiu
Consider this query (using the Babel parser for the :: cast notation from Postgres)
WITH v(x) AS (VALUES(0::numeric),(4.2)) SELECT x FROM v as v1(x)
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:
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)
--
This message was sent by Atlassian Jira
(v8.20.10#820010)