incubator-vxquery-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Vinayak Borkar <>
Subject Re: VXQuery Number Query Plans
Date Thu, 07 Jun 2012 16:55:20 GMT
The data(.) function is required by the XQuery spec for atomization.

Look at:

When a node is passed to anything that expects an atomic type, the typed 
value is extracted. Since at the time of translation we have no idea 
what the input is, we always throw in the data(.) call. The optimizer 
will eliminate it later if it was not required (like in these cases).


On 6/6/12 10:46 PM, Michael Carey wrote:
> And the data(.) function is needed for these expressions because...? :-)
> (I'm enjoying following his explorations - great way to learn!)
> On 6/6/12 7:54 PM, Vinayak Borkar wrote:
>>> My questions:
>>> - in 1. The plan use the function promote. Is this to ensure the type
>>> is correct for the addition function?
>>> - in 1b. Why does the type here show anyAtomicType instead of integer?
>> The add function you use in the query is defined as an operator in the
>> builtin-operators.xml file. Remember that this operator is
>> polymorphic. It can add integers, doubles, duration to dates etc. So
>> the static type of the operator's argument specify that they should be
>> the supertype of all acceptable argument types and that is
>> anyAtomicType in this case.
>> You are correct in that the promote will ensure that the input data is
>> compliant with the expected argument type of the addition function.
>> At runtime, the function needs to make sure that the inputs are
>> correct and throw a dynamic error otherwise.
>> Vinayak

View raw message