You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "Julian Hyde (JIRA)" <ji...@apache.org> on 2017/01/26 23:12:24 UTC

[jira] [Resolved] (CALCITE-1595) NPE in SqlTypeUtil

     [ https://issues.apache.org/jira/browse/CALCITE-1595?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Julian Hyde resolved CALCITE-1595.
----------------------------------
       Resolution: Fixed
    Fix Version/s: 1.12.0

Fixed in http://git-wip-us.apache.org/repos/asf/calcite/commit/a55e5eb4. Thanks for the PR, [~jbalint@gmail.com]!

> 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
>             Fix For: 1.12.0
>
>
> 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)