Uploaded image for project: 'Calcite'
  1. Calcite
  2. CALCITE-3675

SQL to Rel conversion is broken for coalesce on nullable field

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.22.0
    • Component/s: None

      Description

      Reproducible in master (06ac187a342f82a4b69e4c752ccdce0c269a350d): 1.22.0-SNAPSHOT

      SqlToRelConverterTest:

        @Test public void testCoalesceOnNullableField() {
          final String sql = "select coalesce(mgr, 0) from emp";
          sql(sql).ok();
        }
      

      Error:

      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]])
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                anha Anton Haidai
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 2h 10m
                  2h 10m