Issue Details (XML | Word | Printable)

Key: DERBY-3253
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: A B
Reporter: Stan Bradbury
Votes: 0
Watchers: 1
Operations

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

NullPointer Exception (NPE) from query with IN predicate containing two values and joining a view with a large table. ERROR 38000: The exception 'java.lang.NullPointerException' was thrown while evaluating an expression.

Created: 05/Dec/07 02:18 AM   Updated: 30/Jun/09 03:55 PM
Return to search
Component/s: SQL
Affects Version/s: 10.3.1.4, 10.3.2.1, 10.4.1.3
Fix Version/s: 10.3.3.0, 10.4.1.3

Time Tracking:
Not Specified

File Attachments:
  Size
Zip Archive Licensed for inclusion in ASF works 3253ReproDB.zip 2007-12-05 02:22 AM Stan Bradbury 2.17 MB
Text File Licensed for inclusion in ASF works d3253_v1.patch 2007-12-14 04:01 AM A B 5 kB
Text File Licensed for inclusion in ASF works d3253_v2_incomplete.patch 2007-12-17 03:06 AM A B 10 kB
Text File Licensed for inclusion in ASF works d3253_v3.patch 2007-12-17 03:06 AM A B 9 kB
Issue Links:
Duplicate
 
Reference
 

Bug behavior facts: Regression
Resolution Date: 19/Dec/07 05:04 PM


 Description  « Hide
With a single value in the IN clause the query does not fail.
 > Run the following query in the attached database (v 10.3 db).

SELECT A.TIMESTAMP, B.F_NAMEADDR, B.TOTAL_F,
B.TOTAL_FS, B.TOTAL_FT, B.TOTAL_FX
FROM TIME A, THE_VIEW B
WHERE B.T_ID = A.T_ID AND B.F_NAMEADDR IN ('one.two.three.oscar','one.two.three.kathy')
ORDER BY A.TIMESTAMP ASC;

> result

ERROR 38000: The exception 'java.lang.NullPointerException' was thrown while evaluating an expression.
ERROR XJ001: Java exception: ': java.lang.NullPointerException'.

Stack trace:
 Failed Statement is: SELECT A.TIMESTAMP, B.F_NAMEADDR, B.TOTAL_F,
B.TOTAL_FS, B.TOTAL_FT, B.TOTAL_FX
FROM TIME A, THE_VIEW B
WHERE B.T_ID = A.T_ID AND B.F_NAMEADDR IN ('one.two.three.oscar','one.two.three.kathy')
ORDER BY A.TIMESTAMP ASC
ERROR 38000: The exception 'java.lang.NullPointerException' was thrown while evaluating an expression.
at org.apache.derby.iapi.error.StandardException.newException(Unknown Source)
at org.apache.derby.iapi.error.StandardException.unexpectedUserException(Unknown Source)
at org.apache.derby.impl.services.reflect.DirectCall.invoke(Unknown Source)
at org.apache.derby.impl.sql.execute.ProjectRestrictResultSet.getNextRowCore(Unknown Source)
at org.apache.derby.impl.sql.execute.NestedLoopJoinResultSet.getNextRowCore(Unknown Source)
at org.apache.derby.impl.sql.execute.ProjectRestrictResultSet.getNextRowCore(Unknown Source)
at org.apache.derby.impl.sql.execute.SortResultSet.getRowFromResultSet(Unknown Source)
at org.apache.derby.impl.sql.execute.SortResultSet.getNextRowFromRS(Unknown Source)
at org.apache.derby.impl.sql.execute.SortResultSet.loadSorter(Unknown Source)
at org.apache.derby.impl.sql.execute.SortResultSet.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.EmbedStatement.execute(Unknown Source)
at org.apache.derby.impl.jdbc.EmbedStatement.execute(Unknown Source)
at org.apache.derby.impl.tools.ij.ij.executeImmediate(Unknown Source)
at org.apache.derby.impl.tools.ij.utilMain.doCatch(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.Main14.main(Unknown Source)
at org.apache.derby.tools.ij.main(Unknown Source)
Caused by: java.lang.NullPointerException
at org.apache.derby.exe.ac601a400fx0116xa813xc2f7x00000010a3602.e8(Unknown Source)
... 21 more
============= begin nested exception, level (1) ===========
java.lang.NullPointerException
at org.apache.derby.exe.ac601a400fx0116xa813xc2f7x00000010a3602.e8(Unknown Source)
at org.apache.derby.impl.services.reflect.DirectCall.invoke(Unknown Source)
at org.apache.derby.impl.sql.execute.ProjectRestrictResultSet.getNextRowCore(Unknown Source)
at org.apache.derby.impl.sql.execute.NestedLoopJoinResultSet.getNextRowCore(Unknown Source)
at org.apache.derby.impl.sql.execute.ProjectRestrictResultSet.getNextRowCore(Unknown Source)
at org.apache.derby.impl.sql.execute.SortResultSet.getRowFromResultSet(Unknown Source)
at org.apache.derby.impl.sql.execute.SortResultSet.getNextRowFromRS(Unknown Source)
at org.apache.derby.impl.sql.execute.SortResultSet.loadSorter(Unknown Source)
at org.apache.derby.impl.sql.execute.SortResultSet.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.EmbedStatement.execute(Unknown Source)
at org.apache.derby.impl.jdbc.EmbedStatement.execute(Unknown Source)
at org.apache.derby.impl.tools.ij.ij.executeImmediate(Unknown Source)
at org.apache.derby.impl.tools.ij.utilMain.doCatch(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.Main14.main(Unknown Source)
at org.apache.derby.tools.ij.main(Unknown Source)
============= end nested exception, level (1) ===========

Schema info:

CREATE TABLE TIME ("T_ID" BIGINT NOT NULL, "TIMESTAMP" TIMESTAMP NOT NULL, "DAY" INTEGER NOT NULL, "WEEK" INTEGER NOT NULL, "MONTH" INTEGER NOT NULL, "YEAR_COL" INTEGER NOT NULL);

CREATE TABLE F ("F_ID" BIGINT NOT NULL, "T_ID" BIGINT NOT NULL, "F_NAMEADDR" VARCHAR(250) NOT NULL, "TOTAL_F" BIGINT NOT NULL, "TOTAL_FS" BIGINT NOT NULL, "TOTAL_FT" BIGINT NOT NULL, "TOTAL_FX" BIGINT NOT NULL);

CREATE VIEW the_view AS SELECT T.T_ID AS T_ID , T.F_NAMEADDR AS F_NAMEADDR,
 T.TOTAL_F AS TOTAL_F, T.TOTAL_FS AS TOTAL_FS, T.TOTAL_FT AS TOTAL_FT , T.TOTAL_FX AS TOTAL_FX
   FROM F AS T
    WHERE T.T_ID = (SELECT MAX(T_ID) FROM F);


 All   Comments   Work Log   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Repository Revision Date User Message
ASF #605616 Wed Dec 19 16:53:29 UTC 2007 abrown DERBY-3253: Fix NPE for IN list operator when the probe predicate is
pushed into a subselect but then multi-probing does not occur.
Files Changed
MODIFY /db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/InListMultiProbeTest.java
MODIFY /db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/OrNode.java
MODIFY /db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/BinaryRelationalOperatorNode.java

Repository Revision Date User Message
ASF #606277 Fri Dec 21 19:21:53 UTC 2007 abrown DERBY-3253: Fix NPE for IN list operator when the probe predicate is
pushed into a subselect but then multi-probing does not occur. More
specifically, ensure that InListOperatorNode's left operand correctly
reflects its position in the query tree when it is generated.

Porting to 10.3 branch from trunk (svn #605616):

 svn merge -r 605615:605616 https://svn.apache.org/repos/asf/db/derby/code/trunk

No additional changes required.
Files Changed
MODIFY /db/derby/code/branches/10.3/java/engine/org/apache/derby/impl/sql/compile/OrNode.java
MODIFY /db/derby/code/branches/10.3/java/engine/org/apache/derby/impl/sql/compile/BinaryRelationalOperatorNode.java
MODIFY /db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/tests/lang/InListMultiProbeTest.java