Hi community,
I am making use of the Calcite SQLParser and SQLToRelSqlToRelConverter to
convert SQL statements from the TPC-DS benchmark suite. In preparation to adopt
the forthcoming Calcite 1.41.0, I tried using a version of Calcite I built
locally from the current development codebase. I see failures that did not
exist with Calcite 1.40.0 on TPC-DS queries 40, 67 and 80; all on CASE
statements, with the underlying failure in
SqlValidatorImpl.getValidatedNodeType():
Query 40 fails on:
CASE WHEN `CR_REFUNDED_CASH` IS NOT NULL THEN `CR_REFUNDED_CASH` ELSE 0 END
with the underlying error:
java.lang.UnsupportedOperationException: class
org.apache.calcite.sql.SqlBasicCall: `CR_REFUNDED_CASH`
Query 67 fails on:
CASE WHEN `SS_SALES_PRICE` * `SS_QUANTITY` IS NOT NULL THEN `SS_SALES_PRICE` *
`SS_QUANTITY` ELSE 0 END
with the underlying error:
java.lang.UnsupportedOperationException: class
org.apache.calcite.sql.SqlBasicCall: `SS_SALES_PRICE` * `SS_QUANTITY`
Query 80 fails on:
CASE WHEN `SR_RETURN_AMT` IS NOT NULL THEN `SR_RETURN_AMT` ELSE 0 END
with the underlying error:
ava.lang.UnsupportedOperationException: class
org.apache.calcite.sql.SqlBasicCall: `SR_RETURN_AMT`
This regression appears to be introduced in commit
12e7d621bbb19aa32cb45329cb84532115037b7a ([CALCITE-7044] Add internal operator
CAST NOT NULL to enhance rewrite COALESCE operator). Since that commit, the
SqlNode kind at the point of failure in each case has become SqlBasicCall with
a CAST NOT NULL operator, and no node type is identified, which is a failure
condition.
Regards,
Mark.