Jess Balint created CALCITE-1595:
------------------------------------
Summary: NPE in SqlTypeUtil
Key: CALCITE-1595
URL: https://issues.apache.org/jira/browse/CALCITE-1595
Project: Calcite
Issue Type: Bug
Components: core
Reporter: Jess Balint
Assignee: Julian Hyde
Priority: Minor
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:
{code}
public static boolean isExactNumeric(RelDataType type) {
SqlTypeName typeName = type.getSqlTypeName();
if (typeName == null) {
return false;
}
switch (typeName) {
{code}
Here's the stack:
{noformat}
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)
{noformat}
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.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)