Project

Profile

Help

Bug #4330

closed

NullPointerException with XQuery using tumbling window in right hand side of let expression

Added by Martin Honnen over 4 years ago. Updated over 4 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
XQuery conformance
Sprint/Milestone:
-
Start date:
2019-10-02
Due date:
% Done:

0%

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

Description

Running the XQuery 3.1 code

declare namespace output = "http://www.w3.org/2010/xslt-xquery-serialization";

declare option output:method 'xml';
declare option output:indent 'yes';

declare variable $chunk-size as xs:integer external := 500;


let $results := 
    for tumbling window $chunk in /*/*
    start at $sp when $sp mod $chunk-size = 1
    return
        document {
            element { node-name(head($chunk)/..) } {
                $chunk
            }
        }
return $results instance of document-node()+

with Saxon-HE 9.9.1.5J from the command line generates a NullPointerException:

Saxon-HE 9.9.1.5J from Saxonica
Java version 1.8.0_221
Analyzing query from .\test-xquery-split-result-2.xq
java.lang.NullPointerException
        at net.sf.saxon.expr.flwor.WindowClause.copy(WindowClause.java:198)
        at net.sf.saxon.expr.flwor.FLWORExpression.copy(FLWORExpression.java:392)
        at net.sf.saxon.expr.LetExpression.inlineReferences(LetExpression.java:399)
        at net.sf.saxon.expr.LetExpression.optimize(LetExpression.java:331)
        at net.sf.saxon.expr.flwor.FLWORExpression.rewriteForOrLet(FLWORExpression.java:757)
        at net.sf.saxon.expr.flwor.FLWORExpression.optimize(FLWORExpression.java:470)
        at net.sf.saxon.query.XQueryExpression.<init>(XQueryExpression.java:89)
        at net.sf.saxon.Configuration.makeXQueryExpression(Configuration.java:3747)
        at net.sf.saxon.query.XQueryParser.makeXQueryExpression(XQueryParser.java:193)
        at net.sf.saxon.query.StaticQueryContext.compileQuery(StaticQueryContext.java:597)
        at net.sf.saxon.query.StaticQueryContext.compileQuery(StaticQueryContext.java:658)
        at net.sf.saxon.s9api.XQueryCompiler.compile(XQueryCompiler.java:579)
        at net.sf.saxon.Query.compileQuery(Query.java:804)
        at net.sf.saxon.Query.doQuery(Query.java:321)
        at net.sf.saxon.Query.main(Query.java:101)
Fatal error during query: java.lang.NullPointerException:  (no message)

Input sample is attached.

This issue is probably related to https://saxonica.plan.io/issues/4329 but as the symptons are quite different (spurios warning versus exception) I have filed them separately.


Files

input-sample-2000-records.xml (182 KB) input-sample-2000-records.xml Martin Honnen, 2019-10-02 14:14

Please register to edit this issue

Also available in: Atom PDF