You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "Chunwei Lei (Jira)" <ji...@apache.org> on 2020/01/13 04:24:00 UTC

[jira] [Resolved] (CALCITE-3675) SQL to Rel conversion is broken for coalesce on nullable field

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

Chunwei Lei resolved CALCITE-3675.
----------------------------------
    Fix Version/s: 1.22.0
       Resolution: Fixed

Fixed inĀ [536d5032c8a8a749601d5ff4664e6a2e0b8b7c94|https://github.com/apache/calcite/commit/536d5032c8a8a749601d5ff4664e6a2e0b8b7c94]. Thank you for your pr, [~donnyzone]!

> SQL to Rel conversion is broken for coalesce on nullable field
> --------------------------------------------------------------
>
>                 Key: CALCITE-3675
>                 URL: https://issues.apache.org/jira/browse/CALCITE-3675
>             Project: Calcite
>          Issue Type: Bug
>            Reporter: Anton Haidai
>            Priority: Major
>              Labels: pull-request-available
>             Fix For: 1.22.0
>
>          Time Spent: 2h 10m
>  Remaining Estimate: 0h
>
> Reproducible in master (06ac187a342f82a4b69e4c752ccdce0c269a350d): 1.22.0-SNAPSHOT
> SqlToRelConverterTest:
> {code}
>   @Test public void testCoalesceOnNullableField() {
>     final String sql = "select coalesce(mgr, 0) from emp";
>     sql(sql).ok();
>   }
> {code}
> Error:
> {code}
> Conversion to relational algebra failed to preserve datatypes:
> validated type:
> RecordType(INTEGER NOT NULL EXPR$0) NOT NULL
> converted type:
> RecordType(INTEGER EXPR$0) NOT NULL
> rel:
> LogicalProject(EXPR$0=[CASE(IS NOT NULL($3), $3, 0)])
>   LogicalTableScan(table=[[CATALOG, SALES, EMP]])
> {code}



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