You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hive.apache.org by "Jesus Camacho Rodriguez (Jira)" <ji...@apache.org> on 2020/04/26 19:14:00 UTC

[jira] [Updated] (HIVE-23223) Unnecessary CAST to decimal around CASE statement

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

Jesus Camacho Rodriguez updated HIVE-23223:
-------------------------------------------
    Target Version/s: 4.0.0

> Unnecessary CAST to decimal around CASE statement
> -------------------------------------------------
>
>                 Key: HIVE-23223
>                 URL: https://issues.apache.org/jira/browse/HIVE-23223
>             Project: Hive
>          Issue Type: Improvement
>          Components: CBO
>    Affects Versions: 4.0.0
>            Reporter: Jesus Camacho Rodriguez
>            Assignee: Jesus Camacho Rodriguez
>            Priority: Major
>
> After HIVE-23100 went in, there was a missed opportunity on the simplification of a CAST statement on top of a CASE clause, which can be seen in ql/src/test/results/clientpositive/vector_case_when_2.q.out .
> {code}
>                expressions: q548284 (type: int), CASE WHEN ((q548284 = 4)) THEN (0.8) WHEN ((q548284 = 5)) THEN (1) ELSE (8) END (type: decimal(2,1))
> {code}
> was replaced by:
> {code}
>                expressions: q548284 (type: int), CAST( CASE WHEN ((q548284 = 4)) THEN (0.8) WHEN ((q548284 = 5)) THEN (1) ELSE (8) END AS decimal(11,1)) (type: decimal(11,1))
> {code}
> The type of the CASE expression could be inferred and enforce without the CAST.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)