Clone
Daniel Kelleher
committed
on 15 Jul 15
MODE-2494 Adding check whether a child node join has been reversed during query optimization, mirroring logic for SameNodeJoinCondition and … Show more
MODE-2494 Adding check whether a child node join has been reversed during query optimization, mirroring logic for SameNodeJoinCondition and EquiJoinCondition.

For some complex queries, such as:

SELECT parent.[jcr:path], child1.[jcr:name], desc.[jcr:name]

FROM [nt:unstructured] AS parent

LEFT OUTER JOIN [nt:unstructured] AS child1 ON ISCHILDNODE(child1,parent)

INNER JOIN [nt:unstructured] AS desc on ISCHILDNODE(desc, child1)

LEFT OUTER JOIN [nt:unstructured] AS child2 ON ISCHILDNODE(child2,parent)

WHERE ISCHILDNODE(parent,'/')

AND NAME(child2) = 'Hybrid'

AND NAME(desc) LIKE 'Nissan%'

the query optimizer reverses the left and right sides of the join, leading to an assertion error in ScanningQueryEngine.

This fix checks if the join has been reversed, and creates rowextractors for the opposite columns if this is the case.

Added three tests, two which are fixed by this change, and one which is still an issue, suggesting a deeper problem. For the remaining (@Ignored) test, the exception is in the DescendantNodeJoinCondition code.

This seems less simple to resolve, and probably a true fix lies in ReplaceViews or somewhere similar.

Show less

4.x + 8 more