random items not sorted
Wednesday, 24 November 2021 · 2 messages
TH
Tom De Herdt24 Nov 2021 14:48 #
Hi,
While doing some tests, I noticed an unexpected query result in Basex 9.6.3 (on Windows 10).
This query:
let $ids := for $i in 1 to 10 return random:uuid()
for $id in $ids
order by $id
return $id... returns 10 UUIDs, but they are /not/ sorted.
Information from the Info pane in the GUI:
Compiling:
- rewrite range expression to range sequence: (1 to 10)
- rewrite simple map to util:replicate(items,count[,multiple]): (1 to
10) !
random:uuid() -> util:replicate(random:uuid(), 10, true())
- inline for $i_1 in (1 to 10)
- simplify FLWOR expression: util:replicate(random:uuid(), 10, true())
- inline let $ids_0 := util:replicate(random:uuid(), 10, true())
- rewrite fn:sort(items[,collation[,function]]) to
util:replicate(items,count[,multiple]):
sort(util:replicate(random:uuid(), 10, true())) ->
util:replicate(random:uuid(), 10, true())
- inline for $id_2 in util:replicate(random:uuid(), 10, true())
- simplify FLWOR expression: util:replicate(random:uuid(), 10, true()) Optimized Query:
util:replicate(random:uuid(), 10, true())
In Basex 9.3.2 (on another Windows machine) items are sorted alphabetically, as I would expect them to be – but I may be overlooking something.
Any ideas?
Thanks,
Tom De HerdtCG
Christian Grün24 Nov 2021 17:03 #
…thanks for the easily reproducible bug report. The issue has been fixed and a new snapshot is available [1].
Best,
Christian
[1] https://files.basex.org/releases/latest/
Quoted text · Tom De Herdt · 35 lines
On Wed, Nov 24, 2021 at 2:48 PM Tom De Herdt <tom.deherdt at skynet.be> wrote: > > Hi, > > While doing some tests, I noticed an unexpected query result in Basex 9.6.3 (on Windows 10). > > This query: > > let $ids := for $i in 1 to 10 return random:uuid() > for $id in $ids > order by $id > return $id > > ... returns 10 UUIDs, but they are not sorted. > > Information from the Info pane in the GUI: > > Compiling: > - rewrite range expression to range sequence: (1 to 10) > - rewrite simple map to util:replicate(items,count[,multiple]): (1 to 10) ! random:uuid() -> util:replicate(random:uuid(), 10, true()) > - inline for $i_1 in (1 to 10) > - simplify FLWOR expression: util:replicate(random:uuid(), 10, true()) > - inline let $ids_0 := util:replicate(random:uuid(), 10, true()) > - rewrite fn:sort(items[,collation[,function]]) to util:replicate(items,count[,multiple]): sort(util:replicate(random:uuid(), 10, true())) -> util:replicate(random:uuid(), 10, true()) > - inline for $id_2 in util:replicate(random:uuid(), 10, true()) > - simplify FLWOR expression: util:replicate(random:uuid(), 10, true()) > Optimized Query: > util:replicate(random:uuid(), 10, true()) > > In Basex 9.3.2 (on another Windows machine) items are sorted alphabetically, as I would expect them to be – but I may be overlooking something. > > Any ideas? > > Thanks, > Tom De Herdt
Written for BaseX 9.6. BaseX may have changed since: please check the current documentation.
⚡Generated with XQuery