Project

Profile

Help

Bug #3279

closed

Query evaluation continues though positional filter can no longer be satisfied

Added by Gunther Rademacher almost 7 years ago. Updated almost 7 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Streaming
Sprint/Milestone:
-
Start date:
2017-06-14
Due date:
% Done:

100%

Estimated time:
Legacy ID:
Applies to branch:
9.8
Fix Committed on Branch:
9.8
Fixed in Maintenance Release:
Platforms:

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

TestPositionalFilter.java (3.46 KB) TestPositionalFilter.java Gunther Rademacher, 2017-06-14 09:53
Actions #1

Updated by Michael Kay almost 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().

Actions #2

Updated by Michael Kay almost 7 years ago

Saxon 9.7 is rewriting the filter expression as a call on fn:subsequence(); Saxon 9.8 is not.

Actions #3

Updated by Michael Kay almost 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.

Actions #4

Updated by Michael Kay almost 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.

Actions #5

Updated by Michael Kay almost 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.

Actions #6

Updated by Michael Kay almost 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.

Actions #7

Updated by Michael Kay almost 7 years ago

  • Status changed from In Progress to Resolved

Fixed the problem with non-integer subscripts.

Actions #8

Updated by O'Neil Delpratt almost 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

Also available in: Atom PDF