You've already forked mariadb-columnstore-engine
mirror of
https://github.com/mariadb-corporation/mariadb-columnstore-engine.git
synced 2025-07-29 08:21:15 +03:00
MCOL-523 Documentation update
This commit is contained in:
@ -9,7 +9,7 @@ Bytestream is compiled and lives in the messageqcpp shared library. The header c
|
||||
|
||||
#include "bytestream.h"
|
||||
|
||||
For UDA(n)F you should not have to instantiate a ByteStream. However, if you implement the Complex Data Model, you will need to use the instances passed to your serialize() and unserialize() methods.
|
||||
For UDA(n)F you should not have to instantiate a ByteStream. However, if you implement :ref:`complexdatamodel`, you will need to use the instances passed to your serialize() and unserialize() methods.
|
||||
|
||||
These typedefs exist only for backwards compatibility and can be ignored:
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
.. _udaf_map:
|
||||
.. _udafmap:
|
||||
|
||||
UDAFMap
|
||||
=======
|
@ -5,9 +5,9 @@ The UserData struct is used for allocating and streaming the intermediate data n
|
||||
|
||||
There may be multiple instantiations of UserData for each UDA(n)F call. Make no assumptions about the contents except within the context of a method call.
|
||||
|
||||
Since there is no need to deal with the UserData Structure unless you are using the Complex Data Mode, the remainder of this page assumes the Complex Data Structure.
|
||||
Since there is no need to deal with the UserData Structure unless you are using :ref:`complexdatamodel`, the remainder of this page assumes :ref:`complexdatamodel`.
|
||||
|
||||
To use the Complex Data Structure, you derive a struct from UserData and override, at the least, the streaming functions.
|
||||
To use :ref:`complexdatamodel`, you derive a struct from UserData and override, at the least, the streaming functions.
|
||||
|
||||
.. rubric:: constructor
|
||||
|
||||
|
@ -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);
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
@ -8,7 +8,6 @@ Using mcsv1_udaf
|
||||
memoryallocation
|
||||
headerfile
|
||||
sourcefile
|
||||
UDAFMap
|
||||
cmakelists
|
||||
compile
|
||||
copylibs
|
||||
|
@ -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.
|
||||
|
@ -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`.
|
||||
|
Reference in New Issue
Block a user