[
https://issues.apache.org/jira/browse/DERBY-4736?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12886049#action_12886049
]
Dag H. Wanvik commented on DERBY-4736:
--------------------------------------
Attaching a patch which makes the ASSERT go away and the query complete, as
well as a new fixture to OuterJoinTest: testDerby4736.
The problem is that a LOJ reordering has happened (cf.
assert-bind-opt-trees.txt: positions of T2, T3 and T4),
the result column lists are regenerated for the affected join nodes.
The change is detected in SelectNode#preprocess, cf. this if-statement, ca line
997:
if (anyChange)
{
FromList afromList = (FromList)
getNodeFactory().getNode(C_NodeTypes.FROM_LIST,
getNodeFactory().doJoinOrderOptimization(),
getContextManager());
bindExpressions(afromList);
}
However, the call to bindExpressions does *not* lead to rebinding of the join
clause ON T2.X = 1, since the join clauses are
bound as part of JoinNode#BindResultColumns, cf cdeferredBindExpressionsall to
deferredBindExpressions. Adding the call
bindResultColumns(aFromList)
to the above if-block makes the ASSERT go away.
I am not convinced that the execution results are correct, though, since it
returns a different number of rows that does PostgreSQL.
I will investigate.
> ASSERT FAIL when code generating a column reference in a join predicate in
> presence of other outer join reordering
> ------------------------------------------------------------------------------------------------------------------
>
> Key: DERBY-4736
> URL: https://issues.apache.org/jira/browse/DERBY-4736
> Project: Derby
> Issue Type: Sub-task
> Components: SQL
> Affects Versions: 10.7.0.0
> Reporter: Dag H. Wanvik
> Attachments: derby-4736-1a.diff, derby-4736-1a.stat
>
>
> From schema given in DERBY-4712, this query gives an ASSERT with sane Derby:
> rs = s.executeQuery("SELECT 1 FROM (T0 LEFT JOIN (T1 LEFT JOIN (T2 LEFT JOIN
> " +
> " (T3 LEFT JOIN T4 ON 1=1) ON T2.X = T3.X) ON
> 1=1) ON 1=1) " +
> " LEFT JOIN " +
> " (T5 INNER JOIN T6 ON 1=1) " +
> " ON T2.X = 1 ");
> Cf the attachments in DERBY-4712 assert-bind-opt-trees.*.
> From preliminary analysis, this error seems to be unrelated to the NPEs
> reported in DERBY-4712, so filing this as a sub-issue.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.