← Back to team overview

maria-discuss team mailing list archive

Re: GSOC 2015 :UDFs returning arrays

 

No,

You SAY the UDF can support them, but you neglect to point to a technical
way how.

If you want to return a row as an array, well, how do you add an item to a
row outside of the UDF, remove one?  How do you count the items in the
row?  How do you get an item by index?  If you want to use internal
Item_result, well, how do you access item functions without a THD?  You
can't get a THD in a UDF, except an opaque pointer to one, unless you pull
in half the server and it isn't really "legal" to do so.  How do you pass
an array to a stored routine, how does the routine modify it, can routines
return arrays or just UDF?  Row as an array is a ludicrous hack.  You can't
even pass row to other functions.

If you want a new UDF interface that can do those things, use a pluggable
item function which I linked to the patch to.  You absolutely can't change
an unversioned binary interface like the existing UDF without risking
server crash.

So, if you want ARRAY to be returned by a UDF, you have to start with a new
UDF interface.  Again, pluggable item func are the right way to do it.

--Justin

On Tue, Mar 10, 2015 at 1:08 PM, Oleksandr Byelkin <sanja@xxxxxxxxxxxxxxxx>
wrote:

> Hi!
>
> On 10.03.15 21:01, Justin Swanhart wrote:
>
>> [accidentally replied only to sender, pasting reply here to all]
>>
>> Hi,
>>
>> So how exactly would you go about returning a row type?  You get four
>> choices with UDF:
>> STRING_RESULT
>> INT_RESULT
>> REAL_RESULT
>> DECIMAL_RESULT (which is handled just like strings, because decimal was a
>> string when UDF interface was baked)
>>
>> You can't change the UDF specification.  It is not versioned :)
>>
>
> I was talking about server internal support which is:
> enum Item_result
> {
>   STRING_RESULT=0, REAL_RESULT, INT_RESULT, ROW_RESULT, DECIMAL_RESULT,
>   TIME_RESULT,IMPOSSIBLE_RESULT
> };
>
> and UDF also can support more :)
>
> [skip]
>

Follow ups

References