db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dag H. Wanvik (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (DERBY-6688) NPE (or sane: ASSERT failure) with ROW_NUMBER in some subqueries
Date Tue, 05 Aug 2014 21:11:12 GMT

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

Dag H. Wanvik updated DERBY-6688:
---------------------------------

    Description: 
This subquery usage works:
{code}
select * from (select x from t order by row_number() over () fetch first 1 row only) tt;
{code}
but this one leads to NPE in insane mode, or a Sanity ASSERT failure in sane mode:
{code}
select * from t where x =  (select x from t order by row_number() over ());
{code}
leading to this error:
{code}
Exception in thread "main" java.sql.SQLException: Java exception: ': java.lang.NullPointerException'.
        at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source)
        at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source)
        at org.apache.derby.impl.jdbc.Util.seeNextException(Unknown Source)
        at org.apache.derby.impl.jdbc.Util.javaException(Unknown Source)
        at org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(Unknown Source)
        at org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(Unknown Source)
        at org.apache.derby.impl.jdbc.EmbedConnection.handleException(Unknown Source)
        at org.apache.derby.impl.jdbc.ConnectionChild.handleException(Unknown Source)
        at org.apache.derby.impl.jdbc.EmbedStatement.execute(Unknown Source)
        at org.apache.derby.impl.jdbc.EmbedStatement.execute(Unknown Source)
        at derby6565.Derby6565.main(Derby6565.java:33)
Caused by: ERROR XJ001: Java exception: ': java.lang.NullPointerException'.
        at org.apache.derby.iapi.error.StandardException.newException(Unknown Source)
        at org.apache.derby.impl.jdbc.SQLExceptionFactory.wrapArgsForTransportAcrossDRDA(Unknown
Source)
        ... 11 more
Caused by: java.lang.NullPointerException
        at org.apache.derby.impl.sql.compile.UnaryOperatorNode.getReceiverInterfaceName(Unknown
Source)
        at org.apache.derby.impl.sql.compile.UnaryOperatorNode.generateExpression(Unknown
Source)
        at org.apache.derby.impl.sql.compile.ResultColumn.generateExpression(Unknown Source)
        at org.apache.derby.impl.sql.compile.ResultColumnList.generateEvaluatedRow(Unknown
Source)
        at org.apache.derby.impl.sql.compile.ResultColumnList.generateCore(Unknown Source)
        at org.apache.derby.impl.sql.compile.ProjectRestrictNode.generateMinion(Unknown Source)
        at org.apache.derby.impl.sql.compile.ProjectRestrictNode.generate(Unknown Source)
        at org.apache.derby.impl.sql.compile.OrderByList.generate(Unknown Source)
        at org.apache.derby.impl.sql.compile.OrderByNode.generate(Unknown Source)
        at org.apache.derby.impl.sql.compile.ProjectRestrictNode.generateMinion(Unknown Source)
        at org.apache.derby.impl.sql.compile.ProjectRestrictNode.generate(Unknown Source)
        at org.apache.derby.impl.sql.compile.RowCountNode.generate(Unknown Source)
        at org.apache.derby.impl.sql.compile.SubqueryNode.generateExpression(Unknown Source)
        at org.apache.derby.impl.sql.compile.BinaryOperatorNode.generateExpression(Unknown
Source)
        at org.apache.derby.impl.sql.compile.ResultColumn.generateExpression(Unknown Source)
        at org.apache.derby.impl.sql.compile.ResultColumnList.generateEvaluatedRow(Unknown
Source)
        at org.apache.derby.impl.sql.compile.ResultColumnList.generateCore(Unknown Source)
        at org.apache.derby.impl.sql.compile.ProjectRestrictNode.generateMinion(Unknown Source)
        at org.apache.derby.impl.sql.compile.ProjectRestrictNode.generate(Unknown Source)
        at org.apache.derby.impl.sql.compile.UpdateNode.generate(Unknown Source)
        at org.apache.derby.impl.sql.compile.StatementNode.generate(Unknown Source)
        at org.apache.derby.impl.sql.GenericStatement.prepMinion(Unknown Source)
        at org.apache.derby.impl.sql.GenericStatement.prepare(Unknown Source)
        at org.apache.derby.impl.sql.conn.GenericLanguageConnectionContext.prepareInternalStatement(Unknown
Source)
        ... 3 more
{code}
The immediate problem is that the field *#operand* is null.


  was:
This subquery usage works:
{code}
select * from (select x from t order by row_number() over () fetch first 1 row only) tt;
{code}
but this one leads to NPE in insane mode, or a Sanity ASSERT failure in sane mode:
{code}
Exception in thread "main" java.sql.SQLException: Java exception: ': java.lang.NullPointerException'.
        at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source)
        at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source)
        at org.apache.derby.impl.jdbc.Util.seeNextException(Unknown Source)
        at org.apache.derby.impl.jdbc.Util.javaException(Unknown Source)
        at org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(Unknown Source)
        at org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(Unknown Source)
        at org.apache.derby.impl.jdbc.EmbedConnection.handleException(Unknown Source)
        at org.apache.derby.impl.jdbc.ConnectionChild.handleException(Unknown Source)
        at org.apache.derby.impl.jdbc.EmbedStatement.execute(Unknown Source)
        at org.apache.derby.impl.jdbc.EmbedStatement.execute(Unknown Source)
        at derby6565.Derby6565.main(Derby6565.java:33)
Caused by: ERROR XJ001: Java exception: ': java.lang.NullPointerException'.
        at org.apache.derby.iapi.error.StandardException.newException(Unknown Source)
        at org.apache.derby.impl.jdbc.SQLExceptionFactory.wrapArgsForTransportAcrossDRDA(Unknown
Source)
        ... 11 more
Caused by: java.lang.NullPointerException
        at org.apache.derby.impl.sql.compile.UnaryOperatorNode.getReceiverInterfaceName(Unknown
Source)
        at org.apache.derby.impl.sql.compile.UnaryOperatorNode.generateExpression(Unknown
Source)
        at org.apache.derby.impl.sql.compile.ResultColumn.generateExpression(Unknown Source)
        at org.apache.derby.impl.sql.compile.ResultColumnList.generateEvaluatedRow(Unknown
Source)
        at org.apache.derby.impl.sql.compile.ResultColumnList.generateCore(Unknown Source)
        at org.apache.derby.impl.sql.compile.ProjectRestrictNode.generateMinion(Unknown Source)
        at org.apache.derby.impl.sql.compile.ProjectRestrictNode.generate(Unknown Source)
        at org.apache.derby.impl.sql.compile.OrderByList.generate(Unknown Source)
        at org.apache.derby.impl.sql.compile.OrderByNode.generate(Unknown Source)
        at org.apache.derby.impl.sql.compile.ProjectRestrictNode.generateMinion(Unknown Source)
        at org.apache.derby.impl.sql.compile.ProjectRestrictNode.generate(Unknown Source)
        at org.apache.derby.impl.sql.compile.RowCountNode.generate(Unknown Source)
        at org.apache.derby.impl.sql.compile.SubqueryNode.generateExpression(Unknown Source)
        at org.apache.derby.impl.sql.compile.BinaryOperatorNode.generateExpression(Unknown
Source)
        at org.apache.derby.impl.sql.compile.ResultColumn.generateExpression(Unknown Source)
        at org.apache.derby.impl.sql.compile.ResultColumnList.generateEvaluatedRow(Unknown
Source)
        at org.apache.derby.impl.sql.compile.ResultColumnList.generateCore(Unknown Source)
        at org.apache.derby.impl.sql.compile.ProjectRestrictNode.generateMinion(Unknown Source)
        at org.apache.derby.impl.sql.compile.ProjectRestrictNode.generate(Unknown Source)
        at org.apache.derby.impl.sql.compile.UpdateNode.generate(Unknown Source)
        at org.apache.derby.impl.sql.compile.StatementNode.generate(Unknown Source)
        at org.apache.derby.impl.sql.GenericStatement.prepMinion(Unknown Source)
        at org.apache.derby.impl.sql.GenericStatement.prepare(Unknown Source)
        at org.apache.derby.impl.sql.conn.GenericLanguageConnectionContext.prepareInternalStatement(Unknown
Source)
        ... 3 more
{code}
The immediate problem is that the field *#operand* is null.



> NPE (or sane: ASSERT failure) with ROW_NUMBER in some subqueries
> ----------------------------------------------------------------
>
>                 Key: DERBY-6688
>                 URL: https://issues.apache.org/jira/browse/DERBY-6688
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>            Reporter: Dag H. Wanvik
>
> This subquery usage works:
> {code}
> select * from (select x from t order by row_number() over () fetch first 1 row only)
tt;
> {code}
> but this one leads to NPE in insane mode, or a Sanity ASSERT failure in sane mode:
> {code}
> select * from t where x =  (select x from t order by row_number() over ());
> {code}
> leading to this error:
> {code}
> Exception in thread "main" java.sql.SQLException: Java exception: ': java.lang.NullPointerException'.
>         at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source)
>         at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source)
>         at org.apache.derby.impl.jdbc.Util.seeNextException(Unknown Source)
>         at org.apache.derby.impl.jdbc.Util.javaException(Unknown Source)
>         at org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(Unknown
Source)
>         at org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(Unknown
Source)
>         at org.apache.derby.impl.jdbc.EmbedConnection.handleException(Unknown Source)
>         at org.apache.derby.impl.jdbc.ConnectionChild.handleException(Unknown Source)
>         at org.apache.derby.impl.jdbc.EmbedStatement.execute(Unknown Source)
>         at org.apache.derby.impl.jdbc.EmbedStatement.execute(Unknown Source)
>         at derby6565.Derby6565.main(Derby6565.java:33)
> Caused by: ERROR XJ001: Java exception: ': java.lang.NullPointerException'.
>         at org.apache.derby.iapi.error.StandardException.newException(Unknown Source)
>         at org.apache.derby.impl.jdbc.SQLExceptionFactory.wrapArgsForTransportAcrossDRDA(Unknown
Source)
>         ... 11 more
> Caused by: java.lang.NullPointerException
>         at org.apache.derby.impl.sql.compile.UnaryOperatorNode.getReceiverInterfaceName(Unknown
Source)
>         at org.apache.derby.impl.sql.compile.UnaryOperatorNode.generateExpression(Unknown
Source)
>         at org.apache.derby.impl.sql.compile.ResultColumn.generateExpression(Unknown
Source)
>         at org.apache.derby.impl.sql.compile.ResultColumnList.generateEvaluatedRow(Unknown
Source)
>         at org.apache.derby.impl.sql.compile.ResultColumnList.generateCore(Unknown Source)
>         at org.apache.derby.impl.sql.compile.ProjectRestrictNode.generateMinion(Unknown
Source)
>         at org.apache.derby.impl.sql.compile.ProjectRestrictNode.generate(Unknown Source)
>         at org.apache.derby.impl.sql.compile.OrderByList.generate(Unknown Source)
>         at org.apache.derby.impl.sql.compile.OrderByNode.generate(Unknown Source)
>         at org.apache.derby.impl.sql.compile.ProjectRestrictNode.generateMinion(Unknown
Source)
>         at org.apache.derby.impl.sql.compile.ProjectRestrictNode.generate(Unknown Source)
>         at org.apache.derby.impl.sql.compile.RowCountNode.generate(Unknown Source)
>         at org.apache.derby.impl.sql.compile.SubqueryNode.generateExpression(Unknown
Source)
>         at org.apache.derby.impl.sql.compile.BinaryOperatorNode.generateExpression(Unknown
Source)
>         at org.apache.derby.impl.sql.compile.ResultColumn.generateExpression(Unknown
Source)
>         at org.apache.derby.impl.sql.compile.ResultColumnList.generateEvaluatedRow(Unknown
Source)
>         at org.apache.derby.impl.sql.compile.ResultColumnList.generateCore(Unknown Source)
>         at org.apache.derby.impl.sql.compile.ProjectRestrictNode.generateMinion(Unknown
Source)
>         at org.apache.derby.impl.sql.compile.ProjectRestrictNode.generate(Unknown Source)
>         at org.apache.derby.impl.sql.compile.UpdateNode.generate(Unknown Source)
>         at org.apache.derby.impl.sql.compile.StatementNode.generate(Unknown Source)
>         at org.apache.derby.impl.sql.GenericStatement.prepMinion(Unknown Source)
>         at org.apache.derby.impl.sql.GenericStatement.prepare(Unknown Source)
>         at org.apache.derby.impl.sql.conn.GenericLanguageConnectionContext.prepareInternalStatement(Unknown
Source)
>         ... 3 more
> {code}
> The immediate problem is that the field *#operand* is null.



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Mime
View raw message