db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Yip Ng (JIRA)" <derby-...@db.apache.org>
Subject [jira] Commented: (DERBY-939) NullPointerException at ResultSet.close() time for simple query using UNION and INTERSECT
Date Fri, 21 Jul 2006 09:55:15 GMT
    [ http://issues.apache.org/jira/browse/DERBY-939?page=comments#action_12422599 ] 
            
Yip Ng commented on DERBY-939:
------------------------------

I believe the root of this problem is that the SetOpResultSet which implements the execution
logic of INTERSECT and EXCEPT set operation does not have a corresponding runtime statistics(RTS)
class define.  When the RTS mode is turned on via the derby.language.logQueryPlan property,
the RealUnionResultSetStatistics object attempts to obtain the plan text from its child source
inputs.  But since RealResultSetStatisticsFactory does not handle SetOpResultSet(intersect
for the above case), its getResultSetStatistics() method will return null which eventually
will cause the NPE from the RealUnionResultSetStatistics object.  I am almost done with the
patch and will post it here for review when it passes the derbyall regression.


> NullPointerException at ResultSet.close() time for simple query using UNION and INTERSECT
> -----------------------------------------------------------------------------------------
>
>                 Key: DERBY-939
>                 URL: http://issues.apache.org/jira/browse/DERBY-939
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.2.0.0, 10.1.3.0
>         Environment: Embedded and server modes, with derby.language.logQueryPlan=true
>            Reporter: A B
>            Priority: Minor
>
> If I set "derby.language.logQueryPlan" to true and then attempt to execute the following
simple query using UNION and INTERSECT, Derby will return the correct results and then, _after_
returning the results, will throw a NullPointerException.  This error also occurs for 10.1.
> To reproduce:
> > java -Dderby.language.logQueryPlan=true org.apache.derby.tools.ij
> and then do:
> create table t1 (i int);
> create table t2 (j int);
> create table t3 (a int);
> ij> select i from t1 union (select j from t2 intersect select a from t3);
> 1
> -----------
> 0 rows selected
> ERROR XJ001: Java exception: ': java.lang.NullPointerException'.
> If I add data, the query will return the correct results,  but then throw the NPE.
> insert into t1 values 1, 2, 3, 4, 5;
> insert into t2 values 2, 4, 6, 8, 10;
> insert into t3 values 2, 3, 4;
> ij> select i from t1 union (select j from t2 intersect select a from t3);
> 1
> -----------
> 1
> 2
> 3
> 4
> 5
> 5 rows selected
> ERROR XJ001: Java exception: ': java.lang.NullPointerException'.
> The embedded and client stack traces are shown below. Both suggest that the problem occurs
during the close of the result set.
> -- Embedded --
> java.lang.NullPointerException
> 	at org.apache.derby.impl.sql.execute.rts.RealUnionResultSetStatistics.getStatementExecutionPlanText(RealUnionResultSetStatistics.java:107)
> 	at org.apache.derby.impl.sql.execute.rts.RealSortStatistics.getStatementExecutionPlanText(RealSortStatistics.java:124)
> 	at org.apache.derby.impl.sql.execute.rts.RunTimeStatisticsImpl.getStatementExecutionPlanText(RunTimeStatisticsImpl.java:293)
> 	at org.apache.derby.impl.sql.execute.BasicNoPutResultSetImpl.finishAndRTS(BasicNoPutResultSetImpl.java:633)
> 	at org.apache.derby.impl.sql.execute.SortResultSet.finish(SortResultSet.java:479)
> 	at org.apache.derby.impl.jdbc.EmbedResultSet.close(EmbedResultSet.java:533)
> 	at org.apache.derby.tools.JDBCDisplayUtil.indent_DisplayResults(JDBCDisplayUtil.java:272)
> 	at org.apache.derby.tools.JDBCDisplayUtil.DisplayResults(JDBCDisplayUtil.java:260)
> 	at org.apache.derby.impl.tools.ij.utilMain.displayResult(utilMain.java:381)
> 	at org.apache.derby.impl.tools.ij.utilMain.doCatch(utilMain.java:434)
> 	at org.apache.derby.impl.tools.ij.utilMain.go(utilMain.java:310)
> 	at org.apache.derby.impl.tools.ij.Main.go(Main.java:203)
> 	at org.apache.derby.impl.tools.ij.Main.mainCore(Main.java:169)
> 	at org.apache.derby.impl.tools.ij.Main14.main(Main14.java:55)
> 	at org.apache.derby.tools.ij.main(ij.java:60)
> -- Client --
> ERROR (no SQLState): actual code point, 4692 does not match expected code point, 9224
> java.sql.SQLException: actual code point, 4692 does not match expected code point, 9224
>         at org.apache.derby.client.am.SqlException.getSQLException(SqlException.java:280)
>         at org.apache.derby.client.am.ResultSet.close(ResultSet.java:412)
>         at org.apache.derby.tools.JDBCDisplayUtil.indent_DisplayResults(JDBCDisplayUtil.java:272)
>         at org.apache.derby.tools.JDBCDisplayUtil.DisplayResults(JDBCDisplayUtil.java:260)
>         at org.apache.derby.impl.tools.ij.utilMain.displayResult(utilMain.java:381)
>         at org.apache.derby.impl.tools.ij.utilMain.doCatch(utilMain.java:434)
>         at org.apache.derby.impl.tools.ij.utilMain.go(utilMain.java:310)
>         at org.apache.derby.impl.tools.ij.Main.go(Main.java:203)
>         at org.apache.derby.impl.tools.ij.Main.mainCore(Main.java:169)
>         at org.apache.derby.impl.tools.ij.Main14.main(Main14.java:55)
>         at org.apache.derby.tools.ij.main(ij.java:60)
> Caused by: org.apache.derby.client.am.DisconnectException: actual code point, 4692 does
not match ex
> pected code point, 9224
>         at org.apache.derby.client.net.Reply.zThrowSyntaxError(Reply.java:1157)
>         at org.apache.derby.client.net.Reply.parseLengthAndMatchCodePoint(Reply.java:1057)
>         at org.apache.derby.client.net.NetConnectionReply.parseSQLCARD(NetConnectionReply.java:2519)
>         at org.apache.derby.client.net.NetConnectionReply.parseRDBCMMreply(NetConnectionReply.java:2
> 00)
>         at org.apache.derby.client.net.NetConnectionReply.readLocalCommit(NetConnectionReply.java:13
> 3)
>         at org.apache.derby.client.net.ConnectionReply.readLocalCommit(ConnectionReply.java:42)
>         at org.apache.derby.client.net.NetConnection.readLocalCommit_(NetConnection.java:1347)
>         at org.apache.derby.client.am.Connection.readCommit(Connection.java:624)
>         at org.apache.derby.client.am.Connection.readAutoCommit(Connection.java:614)
>         at org.apache.derby.client.am.ResultSet.readAutoCommitIfNotAutoCommitted(ResultSet.java:509)
>         at org.apache.derby.client.am.ResultSet.readCloseAndAutoCommit(ResultSet.java:474)
>         at org.apache.derby.client.am.ResultSet.flowCloseAndAutoCommitIfNotAutoCommitted(ResultSet.j
> ava:455)
>         at org.apache.derby.client.am.ResultSet.closeX(ResultSet.java:425)
>         at org.apache.derby.client.am.ResultSet.close(ResultSet.java:407)
> ERROR XJ001: DERBY SQL error: SQLCODE: -1, SQLSTATE: XJ001, SQLERRMC: java.lang.NullPointerException
> [XX] XJ001.U
> java.sql.SQLException: DERBY SQL error: SQLCODE: -1, SQLSTATE: XJ001, SQLERRMC: java.lang.NullPointerException[XX]XJ001.U
>         at org.apache.derby.client.am.SqlException.getSQLException(SqlException.java:280)
>         at org.apache.derby.client.am.SqlException.getSQLException(SqlException.java:295)
>         at org.apache.derby.client.am.ResultSet.close(ResultSet.java:412)
>         at org.apache.derby.tools.JDBCDisplayUtil.indent_DisplayResults(JDBCDisplayUtil.java:272)
>         at org.apache.derby.tools.JDBCDisplayUtil.DisplayResults(JDBCDisplayUtil.java:260)
>         at org.apache.derby.impl.tools.ij.utilMain.displayResult(utilMain.java:381)
>         at org.apache.derby.impl.tools.ij.utilMain.doCatch(utilMain.java:434)
>         at org.apache.derby.impl.tools.ij.utilMain.go(utilMain.java:310)
>         at org.apache.derby.impl.tools.ij.Main.go(Main.java:203)
>         at org.apache.derby.impl.tools.ij.Main.mainCore(Main.java:169)
>         at org.apache.derby.impl.tools.ij.Main14.main(Main14.java:55)
>         at org.apache.derby.tools.ij.main(ij.java:60)

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message