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

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

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

Jess Balint updated CALCITE-1595:
---------------------------------
    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:
{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.

  was:
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.


> 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)