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

[jira] [Comment Edited] (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:comment-tabpanel&focusedCommentId=17008524#comment-17008524 ] 

Feng Zhu edited comment on CALCITE-3675 at 1/6/20 8:14 AM:
-----------------------------------------------------------

There is a gap between type inference logics in different phases for SqlCaseOperator.

Hi, [~anha], are your working on this issue? I opened a PR. If you are working on the issue, I will close it.


was (Author: donnyzone):
There is a gap between type inference logics in different phases for SqlCaseOperator.

Hi, [~anha], are your working on this issue? If not, I'd like to solve it.

> 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
>          Time Spent: 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)