Serhii Harnyk created DRILL-5048: ------------------------------------ Summary: AssertionError when case statement is used with timestamp and null Key: DRILL-5048 URL: https://issues.apache.org/jira/browse/DRILL-5048 Project: Apache Drill Issue Type: Bug Affects Versions: 1.9.0 Reporter: Serhii Harnyk Assignee: Serhii Harnyk Fix For: Future
AssertionError when we use case with timestamp and null: {noformat} 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) {noformat} Stack trace from drillbit.log {noformat} 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 {noformat} -- This message was sent by Atlassian JIRA (v6.3.4#6332)