BaseXdb / basex

BaseX Main Repository.
http://basex.org
BSD 3-Clause "New" or "Revised" License
678 stars 268 forks source link

XQuery: Optimizations for grouping single values #2125

Closed ChristianGruen closed 2 years ago

ChristianGruen commented 2 years ago
for $b in ('a-1', 'a-2')
group by $c := substring-before($b, '-')
return $c

…is simplified to "a".

The same should happen for single items. The following expression …

for $b in ('a-1')
group by $c := substring-before($b, '-')
return $c

…is simplified to group by $c := "a" return $c (illegal as input query, but valid as compiled query).