Here are a few problems I can see so far:

1. I don't think we can do function caching for variadic functions. The current 
implementation of user_function::computeResultCaching certainly does not 
support variadic functions, but more importantly, we need a fixed number of 
params to form the index key (unless we start thinking towards having more than 
one cache for variadic functions).

2. The user_function::computeResultCaching does the full computation every time 
it is invoked (and it may be invoked multiple times from the codegen). It 
should cache the result of the 1st computation and simply return it afterwards.

3. In UDFunctionCallIterator::createCache, the line:
   lSpec.theKeyTypes[i] = sig[i]->get_qname().getp();
is not correct if the type of the param is a user-defined type (because the 
store will not understand its name). You must call getBaseBuiltinType() of the 
param type first (like the translator does in line 4401).

4. It's probably worthwhile to do something so that we don't have to recompute 
the args in case of a cache miss. What we have to do is create a temp sequence 
for each arg, and fill it with the corresponding arg value; then bind the arg 
reference to that temp seq, instead the arg wrapper.

5. It's probably worthwhile to allow subtypes of xs:anyAtomicType? as param 
types. Index creation already supports "null" keys, but we will need a new 
probe function. This we should probably do as a phase-2 task.
Your team Zorba Coders is subscribed to branch lp:zorba.

Mailing list:
Post to     :
Unsubscribe :
More help   :

Reply via email to