db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bryan Pendleton (JIRA)" <j...@apache.org>
Subject [jira] Commented: (DERBY-2526) Wrong query results due to column ordering in UNION view
Date Sat, 28 Apr 2007 20:40:15 GMT

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

Bryan Pendleton commented on DERBY-2526:
----------------------------------------

My firstTryPatch is just flat-out wrong. The patch attempted to fix the problem by
move the transitive closure processing from SelectNode.preprocess to
SelectNode.bindResultColumns. However, the transitive closure processing
tries to process the predicates in the predicate list held in SelectNode.wherePredicates,
and that field isn't set up until mid-way through SelectNode.preprocess, by the code:

        /* Pull apart the expression trees */
        if (whereClause != null)
        {
            wherePredicates.pullExpressions(numTables, whereClause);
            whereClause = null;
        }

So until that code has been run, we can't do the transitive closure processing.

Now I am contemplating three alternate ideas:

1) move the code which pulls the expressions out of the whereClause into
the wherePredicates list into SelectNode.bindResultColumns, though
that seems increasingly risky to me.
2) delay the call to JoinNode.deferredBindExpressions, which is where
the column renumbering is done, until after the transitive closure work
has occurred (that is, instead of moving transitive closure processing earlier,
move column renumbering later)
3) rework the code in the transitive closure processing so that it isn't
confused by the column renumbering, presumably by working with the
original column references, not by the renumbered bound references.

So, it's somewhat back to the drawing board, but at least I understand
why the original patch proposal failed, which is good progress.


> Wrong query results due to column ordering in UNION view
> --------------------------------------------------------
>
>                 Key: DERBY-2526
>                 URL: https://issues.apache.org/jira/browse/DERBY-2526
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.0.2.1, 10.1.3.1, 10.2.2.0, 10.3.0.0
>            Reporter: Bryan Pendleton
>         Assigned To: Bryan Pendleton
>         Attachments: badQuery.log, derby-2526.sql, DistinctTestNotes.txt, firstTryPatch.diff,
goodQuery.log
>
>
> I think both select statements in the attached repro script should return 1 row, but
in fact the first statement returns 1 row and the second returns zero rows.
> The only difference between the two statements is that the columns in the UNION view
are listed in a different order (bvw vs. bvw2).
> This seems like a bug to me; the order of the columns in the view definition shouldn't
matter, should it? 
> As Army noted on the derby-dev list, the fact that this reproduces with 10.0 means that
it is not caused by some of the 10.2 optimizer changes. Something else is going wrong.

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