[MDEV-13806] SUGGESTION (Disruptive Innovation): Run R Functions directly from MariaDB SQL statements Created: 2017-09-14  Updated: 2017-09-25

Status: Open
Project: MariaDB Server
Component/s: None
Fix Version/s: None

Type: Task Priority: Major
Reporter: Juan Telleria Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: None


 Description   

There is a really interesting plugin for Excel called BERT: "Basic Excel Toolkit", which allows to call R Functions as if they were regular Excel Functions:

BERT Toolkit

If you have any basic R programming Knowledge, it is interesting to install it and see how it works.

Now I was wondering, ¿Would not it be cool to be able to do the same from a MariaDB's SELECT statement? Nor PostgreSQL, MySQL, or Oracle Database can call a function from an SQL script (Or a trigger or scheduled event) to a R Function.

So, we would be able to execute a query like this:

SELECT
   R_EigenValues_Function(My_Column)
FROM
   MyTable;

Being R_EigenValues_Function() an R user defined function.

Thank you.
Juan



 Comments   
Comment by Juan Telleria [ 2017-09-15 ]

For sending a Vector to an R function the following statement could be used:

SELECT
   R_EigenValues_Function(My_Column)
FROM
   MyTable
GROUP BY
   My_Column;

Or maybe a Window function:

SELECT
   R_EigenValues_Function(My_Column) OVER (PARTITION BY My_Grouping_Column ORDER BY RAND())
FROM
   MyTable;

For sending a Matrix to an R function the following statement could be used:

SELECT
   R_EigenValues_Function(ColumnA, ColumnB)
FROM
   MyTable;

SELECT
   R_EigenValues_Function(*)
FROM
   MyTable;

Comment by Juan Telleria [ 2017-09-25 ]

It is important to be able to keep data close to analytics. Spark indeed can do that, as it has a machine learning module.

Extension in MariaDB through R or Python could cover that gap.

Generated at Thu Feb 08 08:08:31 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.