Issue Details (XML | Word | Printable)

Key: DERBY-3464
Type: Bug Bug
Status: Closed Closed
Resolution: Duplicate
Priority: Major Major
Assignee: Unassigned
Reporter: Steve Ebersole
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Derby

NPE is seemingly simple query

Created: 25/Feb/08 09:40 PM   Updated: 29/Jul/08 03:23 AM
Return to search
Component/s: Network Client
Affects Version/s: 10.3.1.4
Fix Version/s: None

Time Tracking:
Not Specified

Issue Links:
Duplicate
 

Resolution Date: 29/Jul/08 03:23 AM


 Description  « Hide
Not sure if this is specifically a regression caused by DERBY-1624, however I noticed this as a regression to our tests in an attempt to verify the fixes for DERBY-1624 with release 10.3.1.4.

The offending query seems very simple and innocuous:

select count(customer0_.ID) as col_0_0_ from CUSTOMER_TABLE customer0_ group by customer0_.code having customer0_.code in ('GBR' , 'CHA')

leading the the following NPE:

2008-02-25 14:55:56,062 DEBUG [org.hibernate.util.JDBCExceptionReporter:69] could not execute query [select count(customer0_.ID) as col_0_0_ from CUSTOMER_TABLE customer0_ group by customer0_.code having customer0_.code in ('GBR' , 'CHA')]
java.sql.SQLException: The exception 'java.lang.NullPointerException' was thrown while evaluating an expression.
       at org.apache.derby.client.am.SQLExceptionFactory.getSQLException(Unknown Source)
       at org.apache.derby.client.am.SqlException.getSQLException(Unknown Source)
       at org.apache.derby.client.am.PreparedStatement.executeQuery(Unknown Source)
       at org.jboss.resource.adapter.jdbc.WrappedPreparedStatement.executeQuery(WrappedPreparedStatement.java:235)
       at org.hibernate.jdbc.AbstractBatcher.getResultSet(AbstractBatcher.java:186)
       at org.hibernate.loader.Loader.getResultSet(Loader.java:1787)
       at org.hibernate.loader.Loader.doQuery(Loader.java:674)
       at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:236)
       at org.hibernate.loader.Loader.doList(Loader.java:2220)
       at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2104)
       at org.hibernate.loader.Loader.list(Loader.java:2099)
       at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:378)
       at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:338)
       at org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:172)
       at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1121)
       at org.hibernate.impl.QueryImpl.list(QueryImpl.java:79)
       at org.hibernate.ejb.QueryImpl.getResultList(QueryImpl.java:65)
       at com.sun.ts.tests.ejb30.persistence.query.language.Client.test_groupByHaving(Client.java:5197)
Caused by: org.apache.derby.client.am.SqlException: The exception 'java.lang.NullPointerException' was thrown while evaluating an expression.
       at org.apache.derby.client.am.Statement.completeSqlca(Unknown Source)
       at org.apache.derby.client.net.NetStatementReply.parseOpenQueryError(Unknown Source)
       at org.apache.derby.client.net.NetStatementReply.parseOPNQRYreply(Unknown Source)
       at org.apache.derby.client.net.NetStatementReply.readOpenQuery(Unknown Source)
       at org.apache.derby.client.net.StatementReply.readOpenQuery(Unknown Source)
       at org.apache.derby.client.net.NetStatement.readOpenQuery_(Unknown Source)
       at org.apache.derby.client.am.Statement.readOpenQuery(Unknown Source)
       at org.apache.derby.client.am.PreparedStatement.flowExecute(Unknown Source)
       at org.apache.derby.client.am.PreparedStatement.executeQueryX(Unknown Source)

 All   Comments   Work Log   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
A B added a comment - 25/Feb/08 10:14 PM
Hi Steve, thanks for the filing this issue. The stack trace that you posted seems like it may not be complete--esp. the underlying cause of the error does not appear in the trace (from what I can tell). Is there more to the trace that you have not posted? Or if possible, do you have a "derby.log" file which contains any errors in it?

Do you have a simple reproduction case for this issue? I looked at the query above and was able to generate an NPE against 10.3.1.4 with the following:

  connect 'testdb;create=true';
  create table t1 (i int, c char(3));
  insert into t1 values (1, 'ONE'), (2, 'TWO'), (3, 'CHA');
  select count(a.i) as col0_0_ from t1 a group by a.c having a.c in ('GBR', 'CHA');

If you run those simple statements do you see an NPE, and if so, does it look like the same problem you are seeing? Without having any further information, I'm wondering if you are seeing DERBY-3253, which was also filed against 10.3.1.4 but has since been fixed in the 10.3 codeline. At least, the above example query, which fails with 10.3.1.4, now runs without error on the latest 10.3 branch.

Is it possible for you to build a set of jars from the 10.3 codeline and see if your query still fails?

Kathey Marsden added a comment - 25/Feb/08 10:18 PM
I see the NPE with 10.3.2.1 with this script:
connect 'jdbc:derby:wombat;create=true';
drop table customer_table;
 
CREATE TABLE CUSTOMER_TABLE ( ID VARCHAR(255) PRIMARY KEY NOT NULL, NAME VARCHAR(255) , CODE VARCHAR(255));
insert into CUSTOMER_TABLE VALUES('1234','Customer 1', 'GBR');
insert into CUSTOMER_TABLE VALUES('1235','Customer 2', 'CHA');

select count(customer0_.ID) as col_0_0_ from CUSTOMER_TABLE customer0_ group by customer0_.code having customer0_.code in ('GBR' , 'CHA') ;

but I do not see it with the latest on the 10.3 branch. I'm not sure what fixed it. I'll backtrack and see.

Shelly McGowan added a comment - 26/Feb/08 05:25 PM
Building the latest trunk, Apache Derby Network Server - 10.4.0.0 alpha - (631277), the query no longer fails which is consistent with your results above.
Hibernate: select count(customer0_.ID) as col_0_0_ from CUSTOMER_TABLE customer0_ group by customer0_.code having customer0_.code in ('GBR' , 'CHA')
Check result received . . .
Check result received . . .
Expected results received.
STATUS:Passed.

Myrna van Lunteren added a comment - 30/Apr/08 09:04 PM
So, this should get closed as fixed in 10.4, or maybe a duplicate?

Shelly McGowan added a comment - 01/May/08 03:25 PM
This is fixed in 10.4 but would be interesting to know the "duplicate" or related issue to the resolution as Kathey notes above.

Knut Anders Hatlen added a comment - 02/May/08 09:25 AM
The Subversion repository is down, so I can't verify it, but I would guess that it was fixed in DERBY-3253.

Dag H. Wanvik added a comment - 05/May/08 12:09 PM
Knut Anders> The Subversion repository is down, so I can't verify it,
Knut Anders> but I would guess that it was fixed in DERBY-3253.

Verified that Kathey's script error is fixed on 10.3 by svn 606277 (DERBY-3253).
You OK with closing issue this, Shelly?


Shelly McGowan added a comment - 10/Jun/08 02:16 PM
I'll verify against 10.3 and update.

Kathey Marsden added a comment - 25/Jul/08 04:57 PM
I wonder if we can go ahead and close this out as a dup? Unless I hear back. I will close it Monday.

Shelly McGowan added a comment - 29/Jul/08 02:41 AM
Kathey, I have verified this is resolved with 10.3 and 10.4.

Kathey Marsden added a comment - 29/Jul/08 03:23 AM
Duplicate DERBY-3253