Uploaded image for project: 'Apache Drill'
  1. Apache Drill
  2. DRILL-5048

Fix type mismatch error in case statement with null timestamp

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.9.0
    • 1.10.0
    • None
    • None

    Description

      AssertionError when we use case with timestamp and null:

      0: jdbc:drill:schema=dfs.tmp> SELECT res, CASE res WHEN true THEN CAST('1990-10-10 22:40:50' AS TIMESTAMP) ELSE null END
      . . . . . . . . . . . . . . > FROM
      . . . . . . . . . . . . . . > (
      . . . . . . . . . . . . . . >     SELECT
      . . . . . . . . . . . . . . >     (CASE WHEN (false) THEN null ELSE CAST('1990-10-10 22:40:50' AS TIMESTAMP) END) res
      . . . . . . . . . . . . . . >     FROM (values(1)) foo
      . . . . . . . . . . . . . . > ) foobar;
      Error: SYSTEM ERROR: AssertionError: Type mismatch:
      rowtype of new rel:
      RecordType(TIMESTAMP(0) NOT NULL res, TIMESTAMP(0) EXPR$1) NOT NULL
      rowtype of set:
      RecordType(TIMESTAMP(0) res, TIMESTAMP(0) EXPR$1) NOT NULL
      
      
      [Error Id: b56e0a4d-2f9e-4afd-8c60-5bc2f9d31f8f on centos-01.qa.lab:31010] (state=,code=0)
      

      Stack trace from drillbit.log

      Caused by: java.lang.AssertionError: Type mismatch:
      rowtype of new rel:
      RecordType(TIMESTAMP(0) NOT NULL res, TIMESTAMP(0) EXPR$1) NOT NULL
      rowtype of set:
      RecordType(TIMESTAMP(0) res, TIMESTAMP(0) EXPR$1) NOT NULL
              at org.apache.calcite.plan.RelOptUtil.equal(RelOptUtil.java:1696) ~[calcite-core-1.4.0-drill-r18.jar:1.4.0-drill-r18]
              at org.apache.calcite.plan.volcano.RelSubset.add(RelSubset.java:295) ~[calcite-core-1.4.0-drill-r18.jar:1.4.0-drill-r18]
              at org.apache.calcite.plan.volcano.RelSet.add(RelSet.java:147) ~[calcite-core-1.4.0-drill-r18.jar:1.4.0-drill-r18]
              at org.apache.calcite.plan.volcano.VolcanoPlanner.addRelToSet(VolcanoPlanner.java:1818) ~[calcite-core-1.4.0-drill-r18.jar:1.4.0-drill-r18]
              at org.apache.calcite.plan.volcano.VolcanoPlanner.registerImpl(VolcanoPlanner.java:1760) ~[calcite-core-1.4.0-drill-r18.jar:1.4.0-drill-r18]
              at org.apache.calcite.plan.volcano.VolcanoPlanner.register(VolcanoPlanner.java:1017) ~[calcite-core-1.4.0-drill-r18.jar:1.4.0-drill-r18]
              at org.apache.calcite.plan.volcano.VolcanoPlanner.ensureRegistered(VolcanoPlanner.java:1037) ~[calcite-core-1.4.0-drill-r18.jar:1.4.0-drill-r18]
              at org.apache.calcite.plan.volcano.VolcanoPlanner.ensureRegistered(VolcanoPlanner.java:1940) ~[calcite-core-1.4.0-drill-r18.jar:1.4.0-drill-r18]
              at org.apache.calcite.plan.volcano.VolcanoRuleCall.transformTo(VolcanoRuleCall.java:138) ~[calcite-core-1.4.0-drill-r18.jar:1.4.0-drill-r18]
              ... 16 common frames omitted
      

      Attachments

        Issue Links

          Activity

            People

              sharnyk Serhii Harnyk
              sharnyk Serhii Harnyk
              Khurram Faraaz Khurram Faraaz
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: