1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-12-24 14:20:59 +03:00

MCOL-523 Documentation update

This commit is contained in:
David Hall
2017-09-07 17:22:31 -05:00
parent 7db0b9b0fa
commit fab8948604
8 changed files with 22 additions and 15 deletions

View File

@@ -1,36 +0,0 @@
.. _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;
}

View File

@@ -9,11 +9,10 @@ The easiest way to create these files is to copy them an example closest to the
Your header file must have a class defined that will implement your function. This class must be derived from mcsv1_UDAF and be in the mcsv1sdk namespace. The following examples use the "allnull" UDAF.
First you must include at least the following:
First you must include at least the following::
.. literalinclude:: ../../../allnull.h
:lines: 71-72
:language: cpp
#include "mcsv1_udaf.h"
#include "calpontsystemcatalog.h"
Other headers as needed. Then::
@@ -22,11 +21,20 @@ Other headers as needed. Then::
Next you must create your class that will implement the UDAF. You must have a constructor, virtual destructor and all the methods that are declared pure in the base class mcsv1_UDAF. There are also methods that have base class implementations. These you may extended as needed. Other methods may be added if you feel a need for helpers.
allnull uses the Simple Data Model. See the Complex Data Model chapter to see how that is used. See the MEDIAN example to see the dropValue() usage.
allnull uses the Simple Data Model. See :ref:`complexdatamodel` to see how that is used. See the MEDIAN example to see the dropValue() usage::
.. literalinclude:: ../../../allnull.h
:lines: 94-218
:language: cpp
class allnull : public mcsv1_UDAF
{
public:
allnull() : mcsv1_UDAF(){};
virtual ~allnull(){};
virtual ReturnCode init(mcsv1Context* context, COL_TYPES& colTypes);
virtual ReturnCode reset(mcsv1Context* context);
virtual ReturnCode nextValue(mcsv1Context* context, std::vector<ColumnDatum>& valsIn);
virtual ReturnCode subEvaluate(mcsv1Context* context, const UserData* userDataIn);
virtual ReturnCode evaluate(mcsv1Context* context, static_any::any& valOut);
};

View File

@@ -8,7 +8,6 @@ Using mcsv1_udaf
memoryallocation
headerfile
sourcefile
UDAFMap
cmakelists
compile
copylibs

View File

@@ -13,7 +13,7 @@ The steps required to create a function are:
* 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:`UDAFMap <udafmap>` 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.

View File

@@ -51,7 +51,7 @@ This consists of the createUserData() method that must be over ridden and the Us
Let's take a look at the base user data structure defined in mcsv1_udaf.h:
.. literalinclude:: ../../../mcsv1_udaf.h
:lines: 126-168
:lines: 131-173
:language: cpp
There are two constructors listed. The second one taking a size is used by :ref:`simpledatamodel`.