db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dag H. Wanvik (JIRA)" <j...@apache.org>
Subject [jira] Commented: (DERBY-4391) NullPointerException when comparing indexed column with result from a set operation
Date Fri, 09 Oct 2009 18:19:31 GMT

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

Dag H. Wanvik commented on DERBY-4391:
--------------------------------------

I looked at this patch and verified that the patch solved the issue, and that the new test
case fails without the patch.
Thanks!

I wonder if it is meaningful for the visitor in PredicateList.markReferencedColumns() to go
down into subqueries. This
ColumnReference with the empty source here, stems from inside the subquery, and looking at
the logic in FromBaseTable#changeAccessPath, what we are doing here is to collect needed columns
from the outer table. I think that means that we do not need to look inside a subquery? 

Changing to this visitor declaration makes the query work too:

		CollectNodesVisitor collectCRs = 
            new CollectNodesVisitor(ColumnReference.class,
									SubqueryNode.class);

As for the question of the empty source, 
looking at the query tree, I see that there is indeed a column reference which has an empty
source, which I also
see, e.g in this query: 

   select * from (values 2 union values 2) x

At the corresponding place (column reference) in a query tree for 

   select * from (select * from t union select * from t) x

I see that the column reference source actually points to a result column of the PRN wrapping
the base table in the *left* query tree of the UNION. (That also seems a bit arbitrary, why
not the right? :)  If it is sound for the VALUE case to have an empty column reference, I
can't answer that, because I don't fully understand how the column references are used in
later phases.


> NullPointerException when comparing indexed column with result from a set operation
> -----------------------------------------------------------------------------------
>
>                 Key: DERBY-4391
>                 URL: https://issues.apache.org/jira/browse/DERBY-4391
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.2.2.0, 10.3.3.0, 10.4.2.0, 10.5.3.0, 10.6.0.0
>            Reporter: Knut Anders Hatlen
>            Assignee: Knut Anders Hatlen
>         Attachments: d4391-1a.diff, d4391-1a.stat
>
>
> I'm reporting this issue on behalf of Bernt M. Johnsen.
> If an indexed column is compared with a UNION query (or some other set operation), a
NullPointerException is raised, as can be seen by this sequence of statements in ij:
> ij> create table t(a int not null primary key, b int);
> 0 rows inserted/updated/deleted
> ij> select * from t where a < (values 4 union values 4);
> ERROR XJ001: Java exception: ': java.lang.NullPointerException'.

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