Zorba error [zerr:ZXQP0002]: "theBodyExpr": assertion failed.

Bug #1024892 reported by William Candillon
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Zorba
Fix Released
High
Markos Zaharioudakis

Bug Description

Compiling the following query:
module namespace guestbook = "http://www.28msec.com/templates/guestbook/guestbook";

import module namespace functx = "http://www.functx.com/";

import module namespace db = "http://www.zorba-xquery.com/modules/store/static/collections/dml";
import module namespace idx = "http://www.zorba-xquery.com/modules/store/static/indexes/dml";

declare namespace an = "http://www.zorba-xquery.com/annotations";

declare collection guestbook:entries as node()*;
declare variable $guestbook:entries as xs:QName := xs:QName("guestbook:entries");

(: Access a document range :)
declare %private %an:automatic %an:unique %an:value-range index guestbook:by-date
  on nodes db:collection(xs:QName('guestbook:entries'))
  by guestbook:convert-dateTime(@datetime) as xs:dateTime;
declare %private variable $guestbook:by-date as xs:QName := xs:QName('guestbook:by-date');

declare function guestbook:convert-dateTime($dateTime as xs:string)
as xs:dateTime {
  current-dateTime()
};

Results in

0 libzorba_simplestore.2.5.0.dylib 0x000000010932780a _ZN5zorba16assertion_failedEPKcS1_iS1_ + 74
1 libzorba_simplestore.2.5.0.dylib 0x0000000109488cbf _ZN5zorba13user_function8optimizeEPNS_10CompilerCBE + 1259
2 libzorba_simplestore.2.5.0.dylib 0x000000010921ab66 _ZN5zorba9MarkExprs5applyERNS_15RewriterContextEPNS_4exprERb + 150
3 libzorba_simplestore.2.5.0.dylib 0x000000010920ab69 _ZN5zorba15RuleMajorDriver7rewriteERNS_15RewriterContextE + 125
4 libzorba_simplestore.2.5.0.dylib 0x000000010920bdc2 _ZN5zorba16DefaultOptimizer7rewriteERNS_15RewriterContextE + 304
5 libzorba_simplestore.2.5.0.dylib 0x000000010914d938 _ZN5zorba14TranslatorImpl9end_visitERKNS_12IndexKeyListEPv + 5482
6 libzorba_simplestore.2.5.0.dylib 0x00000001090f706c _ZNK5zorba13AST_IndexDecl6acceptERNS_17parsenode_visitorE + 78
7 libzorba_simplestore.2.5.0.dylib 0x00000001090fd4a2 _ZNK5zorba12VFO_DeclList6acceptERNS_17parsenode_visitorE + 64
8 libzorba_simplestore.2.5.0.dylib 0x00000001090f5b12 _ZNK5zorba6Prolog6acceptERNS_17parsenode_visitorE + 78
9 libzorba_simplestore.2.5.0.dylib 0x00000001090f5a9a _ZNK5zorba13LibraryModule6acceptERNS_17parsenode_visitorE + 96
10 libzorba_simplestore.2.5.0.dylib 0x000000010912afa9 _ZN5zorbaL13translate_auxEPNS_14TranslatorImplERKNS_9parsenodeEPNS_14static_contextEmPNS_11ModulesInfoERKSt3mapINS_7rstringINS_15rstring_classes3repINS_10atomic_intESt11char_traitsIcESaIcEEEEESI_St4lessISI_ESaISt4pairIKSI_SI_EEEbNS_19StaticContextConsts16xquery_version_tE + 105
11 libzorba_simplestore.2.5.0.dylib 0x0000000109142381 _ZN5zorba14TranslatorImpl9end_visitERKNS_12ModuleImportEPv + 7243
12 libzorba_simplestore.2.5.0.dylib 0x00000001090fd432 _ZNK5zorba13SIND_DeclList6acceptERNS_17parsenode_visitorE + 206
13 libzorba_simplestore.2.5.0.dylib 0x00000001090f5b00 _ZNK5zorba6Prolog6acceptERNS_17parsenode_visitorE + 60
14 libzorba_simplestore.2.5.0.dylib 0x00000001090f59fe _ZNK5zorba10MainModule6acceptERNS_17parsenode_visitorE + 78
15 libzorba_simplestore.2.5.0.dylib 0x000000010912afa9 _ZN5zorbaL13translate_auxEPNS_14TranslatorImplERKNS_9parsenodeEPNS_14static_contextEmPNS_11ModulesInfoERKSt3mapINS_7rstringINS_15rstring_classes3repINS_10atomic_intESt11char_traitsIcESaIcEEEEESI_St4lessISI_ESaISt4pairIKSI_SI_EEEbNS_19StaticContextConsts16xquery_version_tE + 105
16 libzorba_simplestore.2.5.0.dylib 0x000000010912ad3e _ZN5zorba9translateERKNS_9parsenodeEPNS_10CompilerCBE + 446
17 libzorba_simplestore.2.5.0.dylib 0x00000001092344b6 _ZN5zorba14XQueryCompiler9normalizeENS_8rchandleINS_9parsenodeEEE + 34
18 libzorba_simplestore.2.5.0.dylib 0x00000001092345cc _ZN5zorba14XQueryCompiler7compileERKNS_8rchandleINS_9parsenodeEEEbRNS1_INS_4exprEEERmRNS_5audit12ScopedRecordE + 130
19 libzorba_simplestore.2.5.0.dylib 0x00000001092355a8 _ZN5zorba14XQueryCompiler7compileERSiRKNS_7rstringINS_15rstring_classes3repINS_10atomic_intESt11char_traitsIcESaIcEEEEERm + 534
20 libzorba_simplestore.2.5.0.dylib 0x0000000109065551 _ZN5zorba10XQueryImpl9doCompileERSiRK19Zorba_CompilerHintsbRm + 861
21 libzorba_simplestore.2.5.0.dylib 0x0000000109065cce _ZN5zorba10XQueryImpl7compileERSiRKNS_8SmartPtrINS_13StaticContextEEERK19Zorba_CompilerHints + 518
22 zorba 0x00000001090437b9 _Z17compileAndExecutePN5zorba5ZorbaERK18ZorbaCMDPropertiesRNS_8SmartPtrINS_13StaticContextEEERKSsRSiRSoR10TimingInfo + 1705
23 zorba 0x000000010904592c main + 4108
24 zorba 0x0000000109041e94 start + 52

Revision history for this message
William Candillon (wcandillon) wrote :

The failing expression is "by guestbook:convert-dateTime(@datetime)"

Changed in zorba:
milestone: none → 2.7
assignee: nobody → Chris Hillery (ceejatec)
Revision history for this message
William Candillon (wcandillon) wrote :

Assigned to you for dispatching.
I believe that it is quite trivial to fix.

Changed in zorba:
importance: Undecided → High
Revision history for this message
Chris Hillery (ceejatec) wrote :

I'm not totally sure who to dispatch to - I would normally think Markos, but he's going to be on vacation for the next week and a half.

Matthias, would this be something you could look at, or else could you re-assign it to someone more appropriate?

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

The problem is that the key expression in the index declaration accesses a function of the module. However, this function doesn't seem to be compiled, yet.

As a side-node, the example above should raise an error because the key expression tries to access the dynamic context (because of fn:current-dateTime) which is not allowed.

Revision history for this message
William Candillon (wcandillon) wrote : Re: [Bug 1024892] Re: Zorba error [zerr:ZXQP0002]: "theBodyExpr": assertion failed.
Download full text (5.6 KiB)

Yes, you can replace current-dateTime() by 1 if it is easier to fix the problem.
In fact the real example wasn't using current-dateTime().

On Mon, Jul 16, 2012 at 6:48 PM, Matthias Brantner
<email address hidden> wrote:
> The problem is that the key expression in the index declaration accesses
> a function of the module. However, this function doesn't seem to be
> compiled, yet.
>
> As a side-node, the example above should raise an error because the key
> expression tries to access the dynamic context (because of fn:current-
> dateTime) which is not allowed.
>
> --
> You received this bug notification because you are subscribed to the bug
> report.
> https://bugs.launchpad.net/bugs/1024892
>
> Title:
> Zorba error [zerr:ZXQP0002]: "theBodyExpr": assertion failed.
>
> Status in Zorba - The XQuery Processor:
> New
>
> Bug description:
> Compiling the following query:
> module namespace guestbook = "http://www.28msec.com/templates/guestbook/guestbook";
>
> import module namespace functx = "http://www.functx.com/";
>
> import module namespace db = "http://www.zorba-xquery.com/modules/store/static/collections/dml";
> import module namespace idx = "http://www.zorba-xquery.com/modules/store/static/indexes/dml";
>
> declare namespace an = "http://www.zorba-xquery.com/annotations";
>
> declare collection guestbook:entries as node()*;
> declare variable $guestbook:entries as xs:QName := xs:QName("guestbook:entries");
>
> (: Access a document range :)
> declare %private %an:automatic %an:unique %an:value-range index guestbook:by-date
> on nodes db:collection(xs:QName('guestbook:entries'))
> by guestbook:convert-dateTime(@datetime) as xs:dateTime;
> declare %private variable $guestbook:by-date as xs:QName := xs:QName('guestbook:by-date');
>
> declare function guestbook:convert-dateTime($dateTime as xs:string)
> as xs:dateTime {
> current-dateTime()
> };
>
> Results in
>
> 0 libzorba_simplestore.2.5.0.dylib 0x000000010932780a _ZN5zorba16assertion_failedEPKcS1_iS1_ + 74
> 1 libzorba_simplestore.2.5.0.dylib 0x0000000109488cbf _ZN5zorba13user_function8optimizeEPNS_10CompilerCBE + 1259
> 2 libzorba_simplestore.2.5.0.dylib 0x000000010921ab66 _ZN5zorba9MarkExprs5applyERNS_15RewriterContextEPNS_4exprERb + 150
> 3 libzorba_simplestore.2.5.0.dylib 0x000000010920ab69 _ZN5zorba15RuleMajorDriver7rewriteERNS_15RewriterContextE + 125
> 4 libzorba_simplestore.2.5.0.dylib 0x000000010920bdc2 _ZN5zorba16DefaultOptimizer7rewriteERNS_15RewriterContextE + 304
> 5 libzorba_simplestore.2.5.0.dylib 0x000000010914d938 _ZN5zorba14TranslatorImpl9end_visitERKNS_12IndexKeyListEPv + 5482
> 6 libzorba_simplestore.2.5.0.dylib 0x00000001090f706c _ZNK5zorba13AST_IndexDecl6acceptERNS_17parsenode_visitorE + 78
> 7 libzorba_simplestore.2.5.0.dylib 0x00000001090fd4a2 _ZNK5zorba12VFO_DeclList6acceptERNS_17parsenode_visitorE + 64
> 8 libzorba_simplestore.2.5.0.dylib 0x00000001090f5b12 _ZNK5zorba6Prolog6acceptERNS_17parsenode_visitorE + 78
> 9 libzorba_simplestore.2.5.0.dylib 0x00000001090f5a9a _ZNK5zorba13LibraryModule6acceptERNS_17parsenode_visitorE + 96
> 10 libzorba_...

Read more...

Chris Hillery (ceejatec)
Changed in zorba:
assignee: Matthias Brantner (matthias-brantner) → Markos Zaharioudakis (markos-za)
Changed in zorba:
status: New → In Progress
Changed in zorba:
status: In Progress → Fix Committed
Changed in zorba:
status: Fix Committed → Fix Released
Revision history for this message
quicksoluction.com (quicksoluctioncom) wrote :
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.