← Back to team overview

maria-discuss team mailing list archive

Re: GSOC 2015 :UDFs returning arrays



One more thing: The UDF interface is stuck in the 2000s (3.23 timeframe).
It has not, and can not, change.  So your only option for returning complex
data is through a string anyway, so using a delimited string or packing a
blob are really the only options.  Maybe someday this bug:
http://bugs.mysql.com/bug.php?id=70947 will get fixed, and a UDF will be
able to: get THD, handle character sets, and return different/new data
types.  Even if it were implemenetd you'll still have to implement the
ARRAY data type in the server though, and then storage engines will have to
be modified to be able to use it.  That requires table functions too,
really, which are part of wl#820/mdev-820.


On Tue, Mar 10, 2015 at 11:38 AM, Justin Swanhart <greenlion@xxxxxxxxx>

> Hi,
> MySQL has no ARRAY data type.  In array is basicaly a nested table data
> type and MySQL doesn't support nested tables either, except through dynamic
> columns.  So, a UDF that returned an array could only be used by other UDF
> that understand arrays.  That isn't very useful.
> I see two options if you want to push this forward:
> a) If you want this to work with MySQL too (the UDF interface is
> identical) then pass data back as delimited text.  For example, I have a
> UDF called RAPID_EXTRACT_ALL(..) which extracts all values for a key from a
> JSON document, and returns the values separated by newline.  I have stored
> routines (or other UDF) that understand newline separated input
> (essentially arrays).  I don't think you can do much better for MySQL at
> the moment.
> b) If you want to be compatible with only MariaDB, what you could do is
> return a BLOB that is properly formatted as a DYNCOL.  This way COLUMN_GET,
> COLUMN_JSON, etc, could work on the blob, and there is a well defined
> interface for transmitting and accessing the data.
> Neither really require development on your part though, except to
> understand how to pack a DYNCOL blob properly.
> --Justin
> On Tue, Mar 10, 2015 at 11:28 AM, Delveri chick <chickdelveri@xxxxxxxxx>
> wrote:
>> Hi
>> My name is Blessing Atie and i would love to participate in the Google
>> summer of code 2015 under Mariadb. I am interested in the project UDF
>> returning arrays. I have build mariadb from source and and i also  ran  the
>> test suites. I am currently studing the sql/sql.** files to understand
>> UDF's and  i also downloaded some ebook on mysql internals and mysql plugin
>> development  which im reading while hoping to find a breakthrough on this
>> project in them. I would love to know if there are any bugs related to this
>> task on JIRA I could work on as a means of preparing for the project.
>> Please give me the link.
>> Regards
>> _______________________________________________
>> Mailing list: https://launchpad.net/~maria-discuss
>> Post to     : maria-discuss@xxxxxxxxxxxxxxxxxxx
>> Unsubscribe : https://launchpad.net/~maria-discuss
>> More help   : https://help.launchpad.net/ListHelp