Aleksandr Efimov created IMPALA-15467:
-----------------------------------------

             Summary: 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


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)

Reply via email to