← Back to team overview

maria-discuss team mailing list archive

Re: GSOC 2015 :UDFs returning arrays



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.


On Tue, Mar 10, 2015 at 11:28 AM, Delveri chick <chickdelveri@xxxxxxxxx>

> 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

Follow ups