Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
None
Description
The stacktrace is the following:
class org.apache.calcite.rex.RexLocalRef cannot be cast to class org.apache.calcite.rex.RexLiteral (org.apache.calcite.rex.RexLocalRef and org.apache.calcite.rex.RexLiteral are in unnamed module of loader 'app') java.lang.ClassCastException: class org.apache.calcite.rex.RexLocalRef cannot be cast to class org.apache.calcite.rex.RexLiteral (org.apache.calcite.rex.RexLocalRef and org.apache.calcite.rex.RexLiteral are in unnamed module of loader 'app') at org.apache.calcite.rel.rel2sql.SqlImplementor$Context.toSql(SqlImplementor.java:695) at org.apache.calcite.rel.rel2sql.SqlImplementor$Context.toSql(SqlImplementor.java:597) ...
The relevant expressions in the Calc operator are the following:
...expr#5=[Sarg[(10..11]]], expr#6=[SEARCH($t0, $t5)]...
The current code in SqlImplementor considers the second argument to SEARCH is always a RexLiteral:
... case SEARCH: final RexCall search = (RexCall) rex; literal = (RexLiteral) search.operands.get(1); final Sarg sarg = castNonNull(literal.getValueAs(Sarg.class)); //noinspection unchecked return toSql(program, search.operands.get(0), literal.getType(), sarg); ...
Attachments
Issue Links
- links to