#334 Optimization of nested FLWR with order by

v8.3
closed
5
2014-09-24
2005-03-22
Michael Kay
No

When a FLWOR expression with an order by clause is
nested inside another FLWR expression, the expression
defining the sort key may be incorrectly moved outside
the outer FLWR expression, because the optimizer fails
to detect that it is dependent on the range variable of
the inner FLWOR. This results in an attempt to evaluate
an uninitialized variable, which may trigger a number
of failures including a NullPointerException or an
AssertionError.

Source fix: chnage the promote() method (line 77) in
net.sf.saxon.sort.TupleSorter to read:

public Expression promote(PromotionOffer offer)

throws XPathException {
Expression exp = offer.accept(this);
if (exp != null) {
return exp;
} else {
base = base.promote(offer);
if (offer.action !=
PromotionOffer.RANGE_INDEPENDENT) {
for (int i=0; i<sortKeys.length; i++) {

sortKeys[i].setSortKey(sortKeys[i].getSortKey().promote(offer));
}
}
return this;
}
}

Discussion

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.





No, thanks