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

Knut Anders Hatlen commented on DERBY-6006:
-------------------------------------------

Thanks, Bryan. I agree that it would be nice with a single call. But it looks 
like we still need to preserve the two original methods, since 
SelectNode.genProjectRestrict() and SelectNode.preprocess() handle GROUP BY and 
ORDER BY separately. It might of course be possible reorganize it somehow.

On the bright side, it looks like we've squashed this particular class of bugs 
for now. There are three calls to removeGeneratedGroupingColumns() in the code 
base: one in SelectNode.genProjectRestrict(), one in NormalizeResultSet.init(), 
and one in SetOperator.buildRCL(). SelectNode already had calls to 
removeOrderByColumns(). This issue adds it to NormalizeResultSet. And Dag will 
add it to SetOperator in DERBY-6008.
                
> NullPointerException in INSERT INTO ... SELECT FROM ... ORDER BY
> ----------------------------------------------------------------
>
>                 Key: DERBY-6006
>                 URL: https://issues.apache.org/jira/browse/DERBY-6006
>             Project: Derby
>          Issue Type: Bug
>          Components: Store
>    Affects Versions: 10.6.2.1, 10.7.1.1, 10.9.1.0, 10.8.3.0
>            Reporter: Knut Anders Hatlen
>            Assignee: Knut Anders Hatlen
>             Fix For: 10.10.0.0
>
>         Attachments: d6006-1a-remove-extra-columns.diff
>
>
> A NullPointerException was reported by Harm-Jan Zwinderman on derby-user:
> http://mail-archives.apache.org/mod_mbox/db-derby-user/201211.mbox/%3C50B66527.5040906%40gmail.com%3E
> I've managed to reproduce it on 10.9.1.0 like this:
> ij version 10.9
> ij> connect 'jdbc:derby:memory:db;create=true';
> ij> create table t(x double);
> 0 rows inserted/updated/deleted
> ij> insert into t values (0);
> 1 row inserted/updated/deleted
> ij> prepare ps as 'insert into t select 1 from t order by x';
> ij> execute ps;
> 1 row inserted/updated/deleted
> ij> execute ps;
> 2 rows inserted/updated/deleted
> ij> execute ps;
> 4 rows inserted/updated/deleted
> ij> execute ps;
> ERROR XJ001: Java exception: ': java.lang.NullPointerException'.
> Full stack trace:
> java.lang.NullPointerException
>       at 
> org.apache.derby.impl.store.access.conglomerate.ConglomerateUtil.createFormatIds(Unknown
>  Source)
>       at org.apache.derby.impl.store.access.heap.Heap.create(Unknown Source)
>       at 
> org.apache.derby.impl.store.access.heap.HeapConglomerateFactory.createConglomerate(Unknown
>  Source)
>       at 
> org.apache.derby.impl.store.access.RAMTransaction.createConglomerate(Unknown 
> Source)
>       at 
> org.apache.derby.impl.sql.execute.TemporaryRowHolderImpl.insert(Unknown 
> Source)
>       at 
> org.apache.derby.impl.sql.execute.InsertResultSet.normalInsertCore(Unknown 
> Source)
>       at org.apache.derby.impl.sql.execute.InsertResultSet.open(Unknown 
> Source)
>       at 
> org.apache.derby.impl.sql.GenericPreparedStatement.executeStmt(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.tools.ij.ij.ExecuteStatement(Unknown Source)
>       at org.apache.derby.impl.tools.ij.ij.ijStatement(Unknown Source)
>       at org.apache.derby.impl.tools.ij.utilMain.runScriptGuts(Unknown Source)
>       at org.apache.derby.impl.tools.ij.utilMain.go(Unknown Source)
>       at org.apache.derby.impl.tools.ij.Main.go(Unknown Source)
>       at org.apache.derby.impl.tools.ij.Main.mainCore(Unknown Source)
>       at org.apache.derby.impl.tools.ij.Main.main(Unknown Source)
>       at org.apache.derby.tools.ij.main(Unknown Source)
>       at org.apache.derby.iapi.tools.run.main(Unknown Source)

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to