BaseX 7.3: unexpected Stack Overflow
Tuesday, 18 September 2012 · 3 messages
TG
Torsten Grust18 Sep 2012 10:02 #
Dear all,
I have been playing with the following toy implementation
of a super-simple associative map (it's mainly an exercise
in demonstrating the use of h-o functions in XQuery 3.0):
Quoted text · 16 lines
> declare namespace map = "http://db.inf.uni-tuebingen.de/map"; > > declare function map:entry($map, $k, $v) { > function($x) { if ($x eq $k) then $v else $map($x) } > }; > > declare function map:empty() > { > function($x) { () } > }; > > > let $map := map:empty(), > $map1 := map:entry($map, 1, ("one", "eins", "uno")), > $map2 := map:entry($map1, 2, ("two", "zwei", "due")) > return $map2(1)
The execution of this script with BaseX 7.3 unexpectedly yields
Stack Overflow: circular variable declaration?
Note that replacing $map2(1) by $map1(1) in the last line returns the expected result ("one", "eins", "uno").
I'd be grateful for any comment/insight.
Cheers and keep up the good work,
--Torsten
--
| Prof. Dr. Torsten Grust
| Database Systems — Universität Tübingen (Germany)
| torsten.grust at uni-tuebingen.de
| db.inf.uni-tuebingen.de
CG
Christian Grün18 Sep 2012 12:39 #
Dear Torsten,
thanks for the bug report, always welcome. The issue is related to the "Info View" in the GUI or, more exactly, the generation of the query plan, which was triggering a recursive loop. It was running fine when the Info View was deactivated (which was the reason why I first couldn't reproduce the issue locally).
We haven't implemented yet a general solution to the core issue (which is discussed in [1] in more detail). Instead, I have just uploaded a latest stable snapshot, which will simply skip some details in the serialized query plan, and won't raise any errors anymore.
Hope this helps,
Christian
[1] https://github.com/BaseXdb/basex/issues/566
[2] http://files.basex.org/releases/latest/
Quoted text · Torsten Grust · 45 lines
On Tue, Sep 18, 2012 at 10:02 AM, Torsten Grust <torsten.grust at gmail.com> wrote: > Dear all, > > I have been playing with the following toy implementation > of a super-simple associative map (it's mainly an exercise > in demonstrating the use of h-o functions in XQuery 3.0): > >> declare namespace map = "http://db.inf.uni-tuebingen.de/map"; >> >> declare function map:entry($map, $k, $v) { >> function($x) { if ($x eq $k) then $v else $map($x) } >> }; >> >> declare function map:empty() >> { >> function($x) { () } >> }; >> >> >> let $map := map:empty(), >> $map1 := map:entry($map, 1, ("one", "eins", "uno")), >> $map2 := map:entry($map1, 2, ("two", "zwei", "due")) >> return $map2(1) > > The execution of this script with BaseX 7.3 unexpectedly yields > > Stack Overflow: circular variable declaration? > > Note that replacing $map2(1) by $map1(1) in the last line returns > the expected result ("one", "eins", "uno"). > > I'd be grateful for any comment/insight. > > Cheers and keep up the good work, > --Torsten > > -- > | Prof. Dr. Torsten Grust > | Database Systems — Universität Tübingen (Germany) > | torsten.grust at uni-tuebingen.de > | db.inf.uni-tuebingen.de > _______________________________________________ > BaseX-Talk mailing list > BaseX-Talk at mailman.uni-konstanz.de > https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk
TG
Torsten Grust18 Sep 2012 14:01 #
Hi Christian,
Quoted text · Christian Grün · 13 lines
On 18 Sep 2012, at 12:39, Christian Grün wrote: > Dear Torsten, > > thanks for the bug report, always welcome. The issue is related to the > "Info View" in the GUI or, more exactly, the generation of the query > plan, which was triggering a recursive loop. It was running fine when > the Info View was deactivated (which was the reason why I first > couldn't reproduce the issue locally). > > We haven't implemented yet a general solution to the core issue (which > is discussed in [1] in more detail). Instead, I have just uploaded a > latest stable snapshot, which will simply skip some details in the > serialized query plan, and won't raise any errors anymore.
many thanks for the quick reply. Deactivating the Info View also fixes the problem for me -- a solution that's good enough for now.
I've found support for h-o functions in BaseX to be perfectly stable, otherwise.
Thanks again,
--Torsten
Quoted text · Christian Grün · 46 lines
> On Tue, Sep 18, 2012 at 10:02 AM, Torsten Grust > <torsten.grust at gmail.com> wrote: >> Dear all, >> >> I have been playing with the following toy implementation >> of a super-simple associative map (it's mainly an exercise >> in demonstrating the use of h-o functions in XQuery 3.0): >> >>> declare namespace map = "http://db.inf.uni-tuebingen.de/map"; >>> >>> declare function map:entry($map, $k, $v) { >>> function($x) { if ($x eq $k) then $v else $map($x) } >>> }; >>> >>> declare function map:empty() >>> { >>> function($x) { () } >>> }; >>> >>> >>> let $map := map:empty(), >>> $map1 := map:entry($map, 1, ("one", "eins", "uno")), >>> $map2 := map:entry($map1, 2, ("two", "zwei", "due")) >>> return $map2(1) >> >> The execution of this script with BaseX 7.3 unexpectedly yields >> >> Stack Overflow: circular variable declaration? >> >> Note that replacing $map2(1) by $map1(1) in the last line returns >> the expected result ("one", "eins", "uno"). >> >> I'd be grateful for any comment/insight. >> >> Cheers and keep up the good work, >> --Torsten >> >> -- >> | Prof. Dr. Torsten Grust >> | Database Systems — Universität Tübingen (Germany) >> | torsten.grust at uni-tuebingen.de >> | db.inf.uni-tuebingen.de >> _______________________________________________ >> BaseX-Talk mailing list >> BaseX-Talk at mailman.uni-konstanz.de >> https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk
--
| Prof. Dr. Torsten Grust
| Database Systems — Universität Tübingen (Germany)
| torsten.grust at uni-tuebingen.de
| db.inf.uni-tuebingen.de
Written for BaseX 7.3. BaseX may have changed since: please check the current documentation.
⚡Generated with XQuery