db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mamta A. Satoor (JIRA)" <j...@apache.org>
Subject [jira] Commented: (DERBY-3880) NPE on a query with having clause involving a join
Date Fri, 17 Oct 2008 16:56:44 GMT

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

Mamta A. Satoor commented on DERBY-3880:
----------------------------------------

Kathey, thanks for providing the working version of the query (ie the one without the explicit
inner join clause). It gives something to compare the failing query against.

While trying to trace through the 2 queries, I found following discripency.

Both successful query and the NPE query fo through the following code path
Thread [main] (Suspended)	
	ProjectRestrictResultSet.doProjection(ExecRow) line: 514	
	ProjectRestrictResultSet.getNextRowCore() line: 291	
	GroupedAggregateResultSet.getRowFromResultSet() line: 580	
	GroupedAggregateResultSet.getNextRowFromRS() line: 566	
	GroupedAggregateResultSet.loadSorter() line: 306	
	GroupedAggregateResultSet.openCore() line: 180	
	ProjectRestrictResultSet.openCore() line: 168	
	ProjectRestrictResultSet(BasicNoPutResultSetImpl).open() line: 245	
	GenericPreparedStatement.execute(Activation, boolean, long) line: 384	
	EmbedStatement40(EmbedStatement).executeStatement(Activation, boolean, boolean) line: 1235

	EmbedStatement40(EmbedStatement).execute(String, boolean, boolean, int, int[], String[])
line: 625	
	EmbedStatement40(EmbedStatement).execute(String) line: 555	
	ij.executeImmediate(String) line: 329	
	Main.go(LocalizedInput, LocalizedOutput, Properties) line: 215	
	utilMain.runScriptGuts() line: 350	
	Main.main(String[]) line: 73	
	utilMain.go(LocalizedInput[], LocalizedOutput, Properties) line: 248	
	Main.mainCore(String[], Main) line: 181	
	Main.main(String[]) line: 73	
	ij.main(String[]) line: 59	

But if you examin row that results after the projection in ProjectRestrictResultSet, you will
notice that the successful query has following row
result	ValueRow  (id=212)	
{ 1, NULL, 10, NULL, NULL, 10, NULL }
whereas NPE query has following row
result	ValueRow  (id=251)	
{ 1, NULL, null, NULL, NULL, 10, NULL }	

As you can see, the 3rd column has value of null in NPE query whereas the successful query
has value 10. Will debug more to see what causes this but thought will post this piece of
information.

> 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
>         Attachments: querytree_fail.txt, querytree_works.txt
>
>
> 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.


Mime
View raw message