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

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

Anton Haidai created CALCITE-3675:
-------------------------------------

             Summary: 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
    Affects Versions: next
            Reporter: Anton Haidai


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)