db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Saurabh Vyas <Saurabh.V...@Sun.COM>
Subject Re: [jira] Created: (DERBY-1763) Using RTRIM(LTRIM(col)) and group by col gives NPE
Date Fri, 25 Aug 2006 12:20:38 GMT
I tried to reproduce the error and I got the following stack trace :


2006-08-25 09:46:24.654 GMT Thread[main,5,main] (XID = 140), (SESSIONID 
= 0), (D ATABASE = test), (DRDAID = null), Failed Statement is: select 
rtrim(ltrim(c1)) , count(*) from tbl1 group by c1
java.lang.NullPointerException
        at 
org.apache.derby.impl.sql.execute.BasicSortObserver.getClone(BasicSor 
tObserver.java:172)
        at 
org.apache.derby.impl.sql.execute.BasicSortObserver.insertNonDuplicat 
eKey(BasicSortObserver.java:92)
        at 
org.apache.derby.impl.sql.execute.AggregateSortObserver.insertNonDupl 
icateKey(AggregateSortObserver.java:124)
        at 
org.apache.derby.impl.store.access.sort.SortBuffer.insert(SortBuffer. 
java:216)
        at 
org.apache.derby.impl.store.access.sort.MergeInserter.insert(MergeIns 
erter.java:111)
        at 
org.apache.derby.impl.sql.execute.GroupedAggregateResultSet.loadSorte 
r(GroupedAggregateResultSet.java:330)
        at 
org.apache.derby.impl.sql.execute.GroupedAggregateResultSet.openCore( 
GroupedAggregateResultSet.java:202)
        at 
org.apache.derby.impl.sql.execute.ProjectRestrictResultSet.openCore(P 
rojectRestrictResultSet.java:172)
        at 
org.apache.derby.impl.sql.execute.ProjectRestrictResultSet.openCore(P 
rojectRestrictResultSet.java:172)
        at 
org.apache.derby.impl.sql.execute.BasicNoPutResultSetImpl.open(BasicN 
oPutResultSetImpl.java:260)
        at 
org.apache.derby.impl.sql.GenericPreparedStatement.execute(GenericPre 
paredStatement.java:358)
        at 
org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(EmbedState 
ment.java:1182)
        at 
org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java :585)
        at 
org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java :517)
        at org.apache.derby.impl.tools.ij.ij.executeImmediate(ij.java:313)
        at 
org.apache.derby.impl.tools.ij.utilMain.doCatch(utilMain.java:488)
        at 
org.apache.derby.impl.tools.ij.utilMain.runScriptGuts(utilMain.java:3 48)
        at org.apache.derby.impl.tools.ij.utilMain.go(utilMain.java:249)
        at org.apache.derby.impl.tools.ij.Main.go(Main.java:204)
        at org.apache.derby.impl.tools.ij.Main.mainCore(Main.java:170)
        at org.apache.derby.impl.tools.ij.Main14.main(Main14.java:56)
        at org.apache.derby.tools.ij.main(ij.java:70)
Cleanup action completed

I am intrested in working on this issue. Can any one give some inputs in 
this ?

thanks,
saurabh


Christopher Schick (JIRA) wrote:

>Using RTRIM(LTRIM(col)) and group by col gives NPE
>--------------------------------------------------
>
>                 Key: DERBY-1763
>                 URL: http://issues.apache.org/jira/browse/DERBY-1763
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.1.3.1
>         Environment: Windows 2000, Sun JDK 1.4.2_10
>            Reporter: Christopher Schick
>
>
>When trying to execute a simple SQL Statement that includes both the RTRIM() and LTRIM()
functions on a column in the SELECT clause and contains a GROUP BY clause on that column,
the following Nullpointer Exception is thrown:
>ERROR XJ001: Java exception: ': java.lang.NullPointerException'.
>This does NOT happen, if only RTRIM() OR LTRIM() is used, or if no GROUP BY clause is
specified.
>
>This issue is quite urgent for us, as we don't see a workaround to achieve the desired
results.
>
>Attached an example table schema and the affected SELECT Statement.
>--------------------------------------------
>CREATE TABLE t1 (
>c1 VARCHAR(10),
>c2 VARCHAR(10)
>);
>
>INSERT INTO t1 VALUES('a', 'b');
>INSERT INTO t1 VALUES('c', 'd');
>
>SELECT RTRIM(LTRIM(c1)), 
>                 COUNT(*)
>FROM t1
>GROUP BY c1;
>
>
>
>  
>


Mime
View raw message