You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "duan xiong (Jira)" <ji...@apache.org> on 2021/09/28 22:54:00 UTC

[jira] [Comment Edited] (CALCITE-4811) Coalesce(null, row) fails with NPE

    [ https://issues.apache.org/jira/browse/CALCITE-4811?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17421813#comment-17421813 ] 

duan xiong edited comment on CALCITE-4811 at 9/28/21, 10:53 PM:
----------------------------------------------------------------

The ROW is a standard operator in Calcite. So I suggest ROW is better. And This title didn't describe this ISSUE very well.


was (Author: nobigo):
The ROW is a standard operator in Calcite. So I suggest ROW is better.

> Coalesce(null, row) fails with NPE
> ----------------------------------
>
>                 Key: CALCITE-4811
>                 URL: https://issues.apache.org/jira/browse/CALCITE-4811
>             Project: Calcite
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 1.27.0
>            Reporter: Sergey Nuyanzin
>            Priority: Major
>              Labels: pull-request-available
>          Time Spent: 20m
>  Remaining Estimate: 0h
>
> Case to reproduce
> {code:sql}
> select coalesce(null,  row(1));
> {code}
> This and other similar queries fail with
> {noformat}
> Caused by: java.lang.NullPointerException
> 	at org.apache.calcite.rel.type.RelDataTypeImpl.getFieldCount(RelDataTypeImpl.java:175)
> 	at org.apache.calcite.rel.type.RelDataTypeFactoryImpl.leastRestrictiveStructuredType(RelDataTypeFactoryImpl.java:228)
> 	at org.apache.calcite.sql.type.SqlTypeFactoryImpl.leastRestrictiveSqlType(SqlTypeFactoryImpl.java:292)
> 	at org.apache.calcite.sql.type.SqlTypeFactoryImpl.leastRestrictive(SqlTypeFactoryImpl.java:160)
> 	at org.apache.calcite.sql.fun.SqlCaseOperator.inferTypeFromValidator(SqlCaseOperator.java:263)
> 	at org.apache.calcite.sql.fun.SqlCaseOperator.inferReturnType(SqlCaseOperator.java:225)
> 	at org.apache.calcite.sql.SqlOperator.validateOperands(SqlOperator.java:502)
> 	at org.apache.calcite.sql.fun.SqlCaseOperator.deriveType(SqlCaseOperator.java:172)
> 	at org.apache.calcite.sql.validate.SqlValidatorImpl$DeriveTypeVisitor.visit(SqlValidatorImpl.java:6277)
> 	at org.apache.calcite.sql.validate.SqlValidatorImpl$DeriveTypeVisitor.visit(SqlValidatorImpl.java:6264)
> 	at org.apache.calcite.sql.SqlCall.accept(SqlCall.java:161)
> 	at org.apache.calcite.sql.validate.SqlValidatorImpl.deriveTypeImpl(SqlValidatorImpl.java:1862)
> 	at org.apache.calcite.sql.validate.SqlValidatorImpl.deriveType(SqlValidatorImpl.java:1847)
> 	at org.apache.calcite.sql.validate.SqlValidatorImpl.inferUnknownTypes(SqlValidatorImpl.java:2019)
> 	at org.apache.calcite.sql.validate.SqlValidatorImpl.expandSelectItem(SqlValidatorImpl.java:461)
> 	at org.apache.calcite.sql.validate.SqlValidatorImpl.validateSelectList(SqlValidatorImpl.java:4409)
> 	at org.apache.calcite.sql.validate.SqlValidatorImpl.validateSelect(SqlValidatorImpl.java:3652)
> 	at org.apache.calcite.sql.validate.SelectNamespace.validateImpl(SelectNamespace.java:64)
> 	at org.apache.calcite.sql.validate.AbstractNamespace.validate(AbstractNamespace.java:89)
> 	at org.apache.calcite.sql.validate.SqlValidatorImpl.validateNamespace(SqlValidatorImpl.java:1100)
> 	at org.apache.calcite.sql.validate.SqlValidatorImpl.validateQuery(SqlValidatorImpl.java:1071)
> 	at org.apache.calcite.sql.SqlSelect.validate(SqlSelect.java:247)
> 	at org.apache.calcite.sql.validate.SqlValidatorImpl.validateScopedExpression(SqlValidatorImpl.java:1046)
> 	at org.apache.calcite.sql.validate.SqlValidatorImpl.validate(SqlValidatorImpl.java:752)
> 	at org.apache.calcite.sql2rel.SqlToRelConverter.convertQuery(SqlToRelConverter.java:585)
> 	at org.apache.calcite.prepare.Prepare.prepareSql(Prepare.java:251)
> 	at org.apache.calcite.prepare.Prepare.prepareSql(Prepare.java:215)
> 	at org.apache.calcite.prepare.CalcitePrepareImpl.prepare2_(CalcitePrepareImpl.java:647)
> 	at org.apache.calcite.prepare.CalcitePrepareImpl.prepare_(CalcitePrepareImpl.java:513)
> 	at org.apache.calcite.prepare.CalcitePrepareImpl.prepareSql(CalcitePrepareImpl.java:483)
> 	at org.apache.calcite.jdbc.CalciteConnectionImpl.parseQuery(CalciteConnectionImpl.java:249)
> 	at org.apache.calcite.jdbc.CalciteMetaImpl.prepareAndExecute(CalciteMetaImpl.java:623)
> 	at org.apache.calcite.avatica.AvaticaConnection.prepareAndExecuteInternal(AvaticaConnection.java:675)
> 	at org.apache.calcite.avatica.AvaticaStatement.executeInternal(AvaticaStatement.java:156)
> 	... 8 more
> {noformat}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)