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

Kathey Marsden commented on DERBY-3033:
---------------------------------------

I was wondering in the skipScan code, should the column values of startPosition 
ever be null?  In this case column[0] is null, but I was wondering if that is 
ever expected.

startPosition   IndexRow  (id=136)      
        column  DataValueDescriptor[1]  (id=149)        
                [0]     null    
        ncols   1       
        orderedNulls    boolean[1]  (id=150)    
                [0]     false   

Just to try to understand the impact I tried this small change, which 
interestingly caused the test case and suiltes.All to pass, but I don't really 
understand what it means for the column value to be null.
I am guessing this is not the correct solution but rather there is some sort of 
problem in generating the column value for startPosition.  Just want to check 
though in case  there is a circumstance where the column value should be null 
and this change is ok.

Index: java/engine/org/apache/derby/impl/sql/execute/NoPutResultSetImpl.java
===================================================================
--- java/engine/org/apache/derby/impl/sql/execute/NoPutResultSetImpl.java       
(revision 574932)
+++ java/engine/org/apache/derby/impl/sql/execute/NoPutResultSetImpl.java       
(working copy)
@@ -388,7 +388,8 @@
                        {
                                if (startKeyLonger)
                                        checkNullCols[cncLen++] = position + 1;
-                               if (startPosition.getColumn(position + 
1).isNull())
+                DataValueDescriptor d = startPosition.getColumn(position +1);
+                               if (d == null || d.isNull())
                                {
                                        returnValue =  true;
                                        if (! startKeyLonger)


Thanks for the help. I am certainly out of my element with this code, so 
appreciate any help or pointers  anyone can offer.

Kathey



> select query results in nullpointer exception in skipScan()
> -----------------------------------------------------------
>
>                 Key: DERBY-3033
>                 URL: https://issues.apache.org/jira/browse/DERBY-3033
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.2.2.0
>         Environment: Windows XP, Java 5.0, JDBC, Derby 10.2.2.0
>            Reporter: Haolan Qin
>         Attachments: d3033-sane-ij-session-10.3.1.5.txt, query_plan.new, 
> query_plan.old, test.rar, test.zip, viewer_10_1.zip
>
>
> The following error was repeatedly thrown when we tried to run a select query 
> via JDBC. Strangely, the exact same select query did not trigger any error 
> when run from the command line console. After we added an index, the error 
> went away completely. 
> java.lang.NullPointerException
>  at org.apache.derby.impl.sql.execute.NoPutResultSetImpl.skipScan(Unknown 
> Source)
>  at org.apache.derby.impl.sql.execute.TableScanResultSet.openCore(Unknown 
> Source)
>  at 
> org.apache.derby.impl.sql.execute.IndexRowToBaseRowResultSet.openCore(Unknown 
> Source)
>  at 
> org.apache.derby.impl.sql.execute.ProjectRestrictResultSet.openCore(Unknown 
> Source)
>  at org.apache.derby.impl.sql.execute.JoinResultSet.openRight(Unknown Source)
>  at org.apache.derby.impl.sql.execute.JoinResultSet.openCore(Unknown Source)
>  at 
> org.apache.derby.impl.sql.execute.ProjectRestrictResultSet.openCore(Unknown 
> Source)
>  at org.apache.derby.impl.sql.execute.SortResultSet.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)

-- 
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