subsequence and streaming

Bug #1011126 reported by William Candillon
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Zorba
Confirmed
Medium
Markos Zaharioudakis

Bug Description

I'm writing the following query which streams fine:
 let $raw-data as xs:string := http:send-request(<http:request
href="http://cf.zorba-xquery.com.s3.amazonaws.com/forecasts.xml"
method="GET" override-media-type="text/plain" />)[2]
 let $data := p:parse($raw-data,
<opt:options><opt:parse-external-parsed-entity
opt:skip-root-nodes="1"/></opt:options>)
 for $node in $data
 where $node/@site-id = "3"
 return
   $node

However if I write:
let $result :=
 let $raw-data as xs:string := http:send-request(<http:request
href="http://cf.zorba-xquery.com.s3.amazonaws.com/forecasts.xml"
method="GET" override-media-type="text/plain" />)[2]
 let $data := p:parse($raw-data,
<opt:options><opt:parse-external-parsed-entity
opt:skip-root-nodes="1"/></opt:options>)
 for $node in $data
 where $node/@site-id = "3"
 return
   $node
return subsequence($result, 1, 1)
The query result is extremely long to compute.

Changed in zorba:
milestone: none → 3.0
assignee: nobody → Markos Zaharioudakis (markos-za)
Changed in zorba:
importance: Undecided → High
Changed in zorba:
assignee: Markos Zaharioudakis (markos-za) → Matthias Brantner (matthias-brantner)
milestone: 3.0 → 2.8
Chris Hillery (ceejatec)
Changed in zorba:
milestone: 2.8 → 2.9
Chris Hillery (ceejatec)
Changed in zorba:
milestone: 2.9 → 3.0
tags: added: string-streaming
Revision history for this message
Matthias Brantner (matthias-brantner) wrote :

The problem is not string-streaming but related to inlining a let variable that is only used once. The problem can be reproduced using the following much smaller query:

let $result := (1 to 10000000)
return subsequence($result, 1, 1)

The plan for this query is (note materialize="true" in the LetVariable)

<flwor::FLWORIterator id="1006">
  <LetVariable name="result" materialize="true" referenced-by="1003">
    <OpToIterator id="1002">
      <SingletonIterator value="xs:integer(1)" id="1000"/>
      <SingletonIterator value="xs:integer(100000000)" id="1001"/>
    </OpToIterator>
  </LetVariable>
  <ReturnClause>
    <LetVarIterator varname="result" id="1003">
      <SingletonIterator value="xs:integer(1)" id="1004"/>
      <SingletonIterator value="xs:integer(1)" id="1005"/>
    </LetVarIterator>
  </ReturnClause>
</flwor::FLWORIterator>

I'm assigning this to Markos for further investigation.

Changed in zorba:
assignee: Matthias Brantner (matthias-brantner) → Markos Zaharioudakis (markos-za)
Revision history for this message
Chris Hillery (ceejatec) wrote :

It seems like this may be related to bug 1204362.

Changed in zorba:
status: New → Confirmed
importance: High → Medium
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.