Bug #3279
closedQuery evaluation continues though positional filter can no longer be satisfied
100%
Description
In previous releases, the evaluation of this query
for $x in saxon:stream(doc('uriresolver:resolve')/*/*)[position() <= 1]
return $x
With Saxon-EE 9.7 and earlier, all of these filters had this behaviour:
[1]
[position() = 1]
[position() <= 1]
[position() le 1]
I am attaching a TestNG test that demonstrates this.
Files
Updated by Michael Kay over 7 years ago
Found a minor issue while investigating this: -explain does not work on a query using saxon:stream() because the underlying StreamInstr assumes it's in XSLT. Fixed in StreamInstr.export().
Updated by Michael Kay over 7 years ago
Saxon 9.7 is rewriting the filter expression as a call on fn:subsequence(); Saxon 9.8 is not.
Updated by Michael Kay over 7 years ago
In both 9.7 and 9.8, the rewrite of the filter expression to use subsequence() is suppressed if the flag "optimizeForStreaming" is set. But in 9.7, this flag is not set for this particular query.
Updated by Michael Kay over 7 years ago
If I remove the code that prevents this rewrite, I get 158 failures of XSLT streaming tests.
For example, in sf-boolean with the code
<xsl:template name="c-008" use-when="$RUN">
<xsl:source-document streamable="yes" href="../docs/books.xml">
<out>
<xsl:value-of select="boolean(BOOKS/BOOK[2])"/>
</out>
</xsl:source-document>
</xsl:template>
I get SXST0067: No watch implemented for subscript
Essentially that's because SubscriptExpressionAdjunct is not implemented.
It turns out that implementing streaming for a subscript expression X[N] isn't difficult, we can just invoke the Feed used for a subsequence expression subsequence(X, N, N). This eliminates all the test failures.
Updated by Michael Kay over 7 years ago
- Category set to Streaming
- Status changed from New to Resolved
- Assignee set to Michael Kay
- Priority changed from Low to Normal
- Fix Committed on Branch 9.8 added
Fixed by (a) removing the test that suppresses rewrite of a positional filter expression when streaming is in used, and (b) implementing a StreamingAdjunct for SubscriptExpressions.
Updated by Michael Kay over 7 years ago
- Status changed from Resolved to In Progress
Re-opening because the code looks wrong in the case where the subscript is not a whole number.
Updated by Michael Kay over 7 years ago
- Status changed from In Progress to Resolved
Fixed the problem with non-integer subscripts.
Updated by O'Neil Delpratt over 7 years ago
- Status changed from Resolved to Closed
- % Done changed from 0 to 100
- Fixed in Maintenance Release 9.8.0.2 added
Patch applied in the Saxon 9.8.0.2 maintenance release
Please register to edit this issue