You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues-all@impala.apache.org by "Aleksandr Efimov (Jira)" <ji...@apache.org> on 2026/10/02 10:35:00 UTC

[jira] [Updated] (IMPALA-15467) Calcite planner fails to infer DECIMAL return type for IF

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

Aleksandr Efimov updated IMPALA-15467:
--------------------------------------
    Description: 
Calcite fails to compile valid IF expressions with DECIMAL branches:

SELECT IF(TRUE, CAST(1 AS DECIMAL(15,3)), CAST(2 AS DECIMAL(15,3)));
SELECT IF(TRUE, CAST(1 AS DECIMAL(15,3)), NULL);

OriginalPlanner compiles both; Calcite reports Unknown type INVALID_TYPE. Reproduced at 2f022a5ca0fc99670bcf197a1f89016cdf78d114 without planner fallback.

DECIMAL return-type inference incorrectly includes IF's BOOLEAN condition. It should use only the two value branches.

The candidate fix passes the Java build and 14 related Maven tests, including precision/scale and NULL regressions. Full upstream precommit and E2E are pending.

  was:
Calcite fails to compile valid IF expressions with DECIMAL branches:

SELECT IF(TRUE, CAST(1 AS DECIMAL(15,3)), CAST(2 AS DECIMAL(15,3)));
SELECT IF(TRUE, CAST(1 AS DECIMAL(15,3)), NULL);

OriginalPlanner compiles both; Calcite reports Unknown type INVALID_TYPE.
Reproduced at 2f022a5ca0fc99670bcf197a1f89016cdf78d114 without planner fallback.

DECIMAL return-type inference incorrectly includes IF's BOOLEAN condition.
It should use only the two value branches.

The candidate fix passes the Java build and 14 related Maven tests, including
precision/scale and NULL regressions. Full upstream precommit and E2E are pending.


> Calcite planner fails to infer DECIMAL return type for IF
> ---------------------------------------------------------
>
>                 Key: IMPALA-15467
>                 URL: https://issues.apache.org/jira/browse/IMPALA-15467
>             Project: IMPALA
>          Issue Type: Bug
>            Reporter: Aleksandr Efimov
>            Assignee: Aleksandr Efimov
>            Priority: Major
>
> Calcite fails to compile valid IF expressions with DECIMAL branches:
> SELECT IF(TRUE, CAST(1 AS DECIMAL(15,3)), CAST(2 AS DECIMAL(15,3)));
> SELECT IF(TRUE, CAST(1 AS DECIMAL(15,3)), NULL);
> OriginalPlanner compiles both; Calcite reports Unknown type INVALID_TYPE. Reproduced at 2f022a5ca0fc99670bcf197a1f89016cdf78d114 without planner fallback.
> DECIMAL return-type inference incorrectly includes IF's BOOLEAN condition. It should use only the two value branches.
> The candidate fix passes the Java build and 14 related Maven tests, including precision/scale and NULL regressions. Full upstream precommit and E2E are pending.



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

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-all-unsubscribe@impala.apache.org
For additional commands, e-mail: issues-all-help@impala.apache.org