Description
I have some RelBuilder code building an expression something like +(+($0, "30"), "30"). Yes, they are string literals This results in an NPE as the type of +($0, "30") is null and it hits the following code:
public static boolean isExactNumeric(RelDataType type) { SqlTypeName typeName = type.getSqlTypeName(); if (typeName == null) { return false; } switch (typeName) {
Here's the stack:
at org.apache.calcite.sql.type.SqlTypeUtil.isExactNumeric(SqlTypeUtil.java:414) at org.apache.calcite.rel.type.RelDataTypeFactoryImpl.createDecimalQuotient(RelDataTypeFactoryImpl.java:521) at org.apache.calcite.sql.type.ReturnTypes$7.inferReturnType(ReturnTypes.java:464) at org.apache.calcite.sql.type.SqlTypeTransformCascade.inferReturnType(SqlTypeTransformCascade.java:54) at org.apache.calcite.sql.type.SqlReturnTypeInferenceChain.inferReturnType(SqlReturnTypeInferenceChain.java:56) at org.apache.calcite.sql.SqlOperator.inferReturnType(SqlOperator.java:469) at org.apache.calcite.rex.RexBuilder.deriveReturnType(RexBuilder.java:271) at org.apache.calcite.rex.RexBuilder.makeCall(RexBuilder.java:245) at org.apache.calcite.tools.RelBuilder.call(RelBuilder.java:529)
Where would be an appropriate place to add a new test for this? I'll get a PR for this and the other stuff created soon.
Thx.
Attachments
Issue Links
- links to