You've already forked mariadb-columnstore-engine
mirror of
https://github.com/mariadb-corporation/mariadb-columnstore-engine.git
synced 2025-12-24 14:20:59 +03:00
MCOL-523 documentation part 2
This commit is contained in:
36
utils/udfsdk/docs/source/usage/UDAFMap.rst
Normal file
36
utils/udfsdk/docs/source/usage/UDAFMap.rst
Normal file
@@ -0,0 +1,36 @@
|
||||
.. _udaf_map:
|
||||
|
||||
UDAFMap
|
||||
=======
|
||||
|
||||
The UDAFMap is where we tell the system about our function. For Columnstore 1.1, you must manually place your function into this map.
|
||||
|
||||
* open mcsv1_udaf.cpp
|
||||
* add your header to the #include list
|
||||
* add a new line to the UDAFMap::getMap() function
|
||||
|
||||
::
|
||||
|
||||
#include "allnull.h"
|
||||
#include "ssq.h"
|
||||
#include "median.h"
|
||||
#include "avg_mode.h"
|
||||
UDAF_MAP& UDAFMap::getMap()
|
||||
{
|
||||
if (fm.size() > 0)
|
||||
{
|
||||
return fm;
|
||||
}
|
||||
// first: function name
|
||||
// second: Function pointer
|
||||
// please use lower case for the function name. Because the names might be
|
||||
// case-insensitive in MySQL depending on the setting. In such case,
|
||||
// the function names passed to the interface is always in lower case.
|
||||
fm["allnull"] = new allnull();
|
||||
fm["ssq"] = new ssq();
|
||||
fm["median"] = new median();
|
||||
fm["avg_mode"] = new avg_mode();
|
||||
|
||||
return fm;
|
||||
}
|
||||
|
||||
15
utils/udfsdk/docs/source/usage/cmakelists.rst
Normal file
15
utils/udfsdk/docs/source/usage/cmakelists.rst
Normal file
@@ -0,0 +1,15 @@
|
||||
.. _cmakelists:
|
||||
|
||||
CMakeLists.txt
|
||||
==============
|
||||
|
||||
For Columnstore 1.1, you compile your function by including it in the CMakeLists.txt file for the udfsdk.
|
||||
|
||||
You need only add the new .cpp files to the udfsdk_LIB_SRCS target list::
|
||||
|
||||
set(udfsdk_LIB_SRCS udfsdk.cpp mcsv1_udaf.cpp allnull.cpp ssq.cpp median.cpp avg_mode.cpp)
|
||||
|
||||
If you create a new file for your MariaDB Aggregate function, add it to the target list for udf_mysql_LIB_SRCS::
|
||||
|
||||
set(udf_mysql_LIB_SRCS udfmysql.cpp)
|
||||
|
||||
12
utils/udfsdk/docs/source/usage/compile.rst
Normal file
12
utils/udfsdk/docs/source/usage/compile.rst
Normal file
@@ -0,0 +1,12 @@
|
||||
.. _compile:
|
||||
|
||||
Compile
|
||||
=======
|
||||
|
||||
To compile your function for Columnstore 1.1, simple recompile the udfsdk directory::
|
||||
|
||||
cd utils/usdsdk
|
||||
cmake .
|
||||
make
|
||||
|
||||
|
||||
12
utils/udfsdk/docs/source/usage/copylibs.rst
Normal file
12
utils/udfsdk/docs/source/usage/copylibs.rst
Normal file
@@ -0,0 +1,12 @@
|
||||
.. _copylibs:
|
||||
|
||||
Copy Libraries
|
||||
==============
|
||||
|
||||
The libraries will be built in the Columnstore source tree at utils/udfsdk. If your using out of source object creation, they will be in the appropriate place.
|
||||
|
||||
Copy the following the lib directory of your installation directory. The default install directory is /usr/local/mariadb/columnstore
|
||||
|
||||
* libudfsdk.so.1.1.0
|
||||
* libudf_mysql.so.1.0.0
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
.. _header_file:
|
||||
|
||||
Header file
|
||||
===========
|
||||
|
||||
|
||||
@@ -8,4 +8,7 @@ Using mcsv1_udaf
|
||||
memoryallocation
|
||||
headerfile
|
||||
sourcefile
|
||||
|
||||
UDAFMap
|
||||
cmakelists
|
||||
compile
|
||||
copylibs
|
||||
|
||||
@@ -9,14 +9,14 @@ The API has a number of features. The general theme is, there is a class that re
|
||||
|
||||
The steps required to create a function are:
|
||||
|
||||
* Decide on memory allocation scheme.
|
||||
* Create a header file for your function.
|
||||
* Create a source file for your function.
|
||||
* Implement mariadb udaf api code.
|
||||
* Add the function to UDAFMap in mcsv1_udaf.cpp
|
||||
* Add the function to CMakeLists.txt in ./utils/udfsdk
|
||||
* Compile udfsdk.
|
||||
* Copy the compiled libraries to the working directories.
|
||||
* Decide on a :ref:`memory allocation <memory_allocation>` scheme.
|
||||
* Create a :ref:`header file <header_file>` for your function.
|
||||
* Create a :ref:`source file <source_file>` for your function.
|
||||
* Implement :ref:`mariadb udaf api <mariadb_udaf>` code.
|
||||
* Add the function to :ref:`UDAFMap <udaf_map>` in mcsv1_udaf.cpp
|
||||
* Add the function to :ref:`CMakeLists.txt <cmakelists>` in ./utils/udfsdk
|
||||
* :ref:`Compile udfsdk <compile>`.
|
||||
* :ref:`Copy the compiled libraries <copylibs>` to the working directories.
|
||||
|
||||
In 1.1.0, Columnstore does not have a plugin framework, so the functions have to be compiled into the libraries that Columnstore already loads.
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
.. _memory_allocation:
|
||||
|
||||
Memory allocation and usage
|
||||
===========================
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
.. _source_file:
|
||||
|
||||
Source file
|
||||
===========
|
||||
|
||||
|
||||
Reference in New Issue
Block a user