← Back to team overview

zorba-coders team mailing list archive

[Bug 921458] Re: file:read-text-lines() blocking

 

Paul, Could you please investigate why William's program doesn't stream after applying the patch below?
I understand why it didn't stream in the trunk (i.e. with fn:tokenize) but using the string:split function, there should be nothing that prevents it from streaming. I guess the problem is somewhere in the implementation of the split function (in src/runtime/strings/strings_impl.cpp).


=== modified file 'modules/org/expath/ns/file.xq'
--- modules/org/expath/ns/file.xq	2011-10-19 05:09:31 +0000
+++ modules/org/expath/ns/file.xq	2012-02-01 20:39:39 +0000
@@ -23,6 +23,8 @@
  :)
 module namespace file = "http://expath.org/ns/file";;
 
+import module namespace string = "http://www.zorba-xquery.com/modules/string";;
+
 import schema namespace output = "http://www.w3.org/2010/xslt-xquery-serialization";;
 declare namespace ann = "http://www.zorba-xquery.com/annotations";;
 declare namespace ver = "http://www.zorba-xquery.com/options/versioning";;
@@ -424,8 +426,7 @@
   $encoding as xs:string
 ) as xs:string*
 {
-  let $content := file:read-text($file, $encoding)
-  return fn:tokenize($content, "\n")
+  string:split(file:read-text($file, $encoding), "f")
 };
 
 (:~


** Changed in: zorba
     Assignee: (unassigned) => Paul J. Lucas (paul-lucas)

-- 
You received this bug notification because you are a member of Zorba
Coders, which is the registrant for Zorba.
https://bugs.launchpad.net/bugs/921458

Title:
  file:read-text-lines() blocking

Status in Zorba - The XQuery Processor:
  New

Bug description:
  I wrote the following query:
  import module namespace file ="http://expath.org/ns/file";;

  for $line at $i in file:read-text-lines("doc.xml")
  return
    if($i lt 1104869) then () else concat($line, "
  ")

  Where doc.xml is a large document.
  The result of the query seems to never end and its memory footprint is huge.

To manage notifications about this bug go to:
https://bugs.launchpad.net/zorba/+bug/921458/+subscriptions


References