[ 
https://issues.apache.org/jira/browse/DERBY-3880?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12631857#action_12631857
 ] 

Venkateswaran Iyer commented on DERBY-3880:
-------------------------------------------

Here's the complete stack:

Apache Derby Network Server - 10.4.2.0 - (689064) started and ready to accept 
connections on port 1527 at 2008-09-16 20:19:45.296 GMT 
----------------------------------------------------------------
2008-09-16 20:26:34.328 GMT:
 Booting Derby version The Apache Software Foundation - Apache Derby - 10.4.2.0 
- (689064): instance a816c00e-011c-6cd1-8f55-00004e6b54c8
on database directory 
C:\apps\derby\db-derby-10.4.2.0-bin\db-derby-10.4.2.0-bin\bin\ClassicModels  

Database Class Loader started - derby.database.classpath=''
2008-09-16 20:27:53.890 GMT Thread[DRDAConnThread_3,5,main] (XID = 525), 
(SESSIONID = 8), (DATABASE = ClassicModels), (DRDAID = 
C0A82DCA.GFE0-4183842832230338175{9}), Cleanup action starting
2008-09-16 20:27:53.890 GMT Thread[DRDAConnThread_3,5,main] (XID = 525), 
(SESSIONID = 8), (DATABASE = ClassicModels), (DRDAID = 
C0A82DCA.GFE0-4183842832230338175{9}), Failed Statement is: SELECT 
"APP"."Orders"."orderNumber", AVG( "APP"."OrderDetails"."quantityOrdered" )
FROM ("APP"."Orders" INNER JOIN "APP"."OrderDetails" ON 
"APP"."Orders"."orderNumber" = "APP"."OrderDetails"."orderNumber" ) 
GROUP BY "APP"."Orders"."orderNumber"
HAVING AVG( "APP"."OrderDetails"."quantityOrdered" ) > 0
java.lang.NullPointerException
        at org.apache.derby.impl.sql.execute.BasicSortObserver.getClone(Unknown 
Source)
        at 
org.apache.derby.impl.sql.execute.BasicSortObserver.insertNonDuplicateKey(Unknown
 Source)
        at 
org.apache.derby.impl.sql.execute.AggregateSortObserver.insertNonDuplicateKey(Unknown
 Source)
        at org.apache.derby.impl.store.access.sort.SortBuffer.insert(Unknown 
Source)
        at org.apache.derby.impl.store.access.sort.MergeInserter.insert(Unknown 
Source)
        at 
org.apache.derby.impl.sql.execute.GroupedAggregateResultSet.loadSorter(Unknown 
Source)
        at 
org.apache.derby.impl.sql.execute.GroupedAggregateResultSet.openCore(Unknown 
Source)
        at 
org.apache.derby.impl.sql.execute.ProjectRestrictResultSet.openCore(Unknown 
Source)
        at 
org.apache.derby.impl.sql.execute.BasicNoPutResultSetImpl.open(Unknown Source)
        at org.apache.derby.impl.sql.GenericPreparedStatement.execute(Unknown 
Source)
        at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(Unknown 
Source)
        at 
org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeStatement(Unknown 
Source)
        at org.apache.derby.impl.jdbc.EmbedPreparedStatement.execute(Unknown 
Source)
        at org.apache.derby.impl.drda.DRDAStatement.execute(Unknown Source)
        at org.apache.derby.impl.drda.DRDAConnThread.processCommands(Unknown 
Source)
        at org.apache.derby.impl.drda.DRDAConnThread.run(Unknown Source)
Cleanup action completed

> NPE on a query with having clause involving a join
> --------------------------------------------------
>
>                 Key: DERBY-3880
>                 URL: https://issues.apache.org/jira/browse/DERBY-3880
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.4.2.0
>         Environment: Windows 2003 Server 
>            Reporter: Venkateswaran Iyer
>            Priority: Minor
>
> A simple query involving a join and having clause causes a NPE. Any 
> subsequent executions cause severe errors. It almost looks like the 
> underlying connection was closed out.
> ====
> C:\apps\derby\db-derby-10.4.2.0-bin\db-derby-10.4.2.0-bin\bin>ij
> ij version 10.4
> ij> connect 'jdbc:derby://speed:1527/ClassicModels;user=sa;password=sa
> ';
> ij> create table t1(i int, c varchar(20));
> 0 rows inserted/updated/deleted
> ij> create table t2(i int, c2 varchar(20), i2 int);
> 0 rows inserted/updated/deleted
> ij> insert into t1 values(1, 'abc');
> 1 row inserted/updated/deleted
> ij> insert into t1 values(2, 'abc');
> 1 row inserted/updated/deleted
> ij> insert into t2 values(1, 'xyz', 10);
> 1 row inserted/updated/deleted
> ij> insert into t2 values(1, 'aaa', 20);
> 1 row inserted/updated/deleted
> ij> insert into t2 values(2, 'xxx', 30);
> 1 row inserted/updated/deleted
> ij> select t1.i, avg(t2.i2) from t1 inner join t2 on (t1.i = t2.i) group by 
> t1.i
>  having avg(t2.i2) > 0;
> ERROR XJ001: DERBY SQL error: SQLCODE: -1, SQLSTATE: XJ001, SQLERRMC: 
> java.lang.
> NullPointerException¶¶XJ001.U

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to