Description
Joins with ISDESCENDANTNODE condition are incorrectly optimized when the join is executed in the reverse order: instead of a path condition of the form "all parents", a path condition of the form "parent" is used. That means, the first selector only traverse the parent node, when the TraversingIndex is used, instead of all possible parent nodes. As of now, there is no path condition of the form "all parents".
This affects both SQL-2 and XPath queries.
It is a problem if the join is reversed due to lower potential cost, which is so far seldom, and it looks like only in combination with the TraversingIndex. There are some existing tests that only fail when the new cost estimation is used (OAK-1907). Still, it is theoretically possible that existing code is affected (even without OAK-1907).