You've already forked mariadb-columnstore-engine
mirror of
https://github.com/mariadb-corporation/mariadb-columnstore-engine.git
synced 2025-07-30 19:23:07 +03:00
MCOL-523 documentation part 3
This commit is contained in:
BIN
utils/udfsdk/docs/build/latex/UDAF.pdf
vendored
BIN
utils/udfsdk/docs/build/latex/UDAF.pdf
vendored
Binary file not shown.
@ -1,3 +1,5 @@
|
||||
.. _bytestream:
|
||||
|
||||
ByteStream
|
||||
==========
|
||||
|
||||
|
@ -1,3 +1,5 @@
|
||||
.. _ mcsv1_udaf:
|
||||
|
||||
mcsv1_UDAF
|
||||
==========
|
||||
|
||||
@ -76,6 +78,8 @@ Destructor
|
||||
Callback Methods
|
||||
----------------
|
||||
|
||||
.. _init:
|
||||
|
||||
.. c:function:: ReturnCode init(mcsv1Context* context, COL_TYPES& colTypes);
|
||||
|
||||
:param context: The context object for this call.
|
||||
@ -98,6 +102,8 @@ Callback Methods
|
||||
|
||||
All flags, return type, Window Frame, etc. set in the context object here will be propogated to any copies made and will be streamed to the various modules. You are guaranteed that these settings will be correct for each callback.
|
||||
|
||||
.. _reset:
|
||||
|
||||
.. c:function:: ReturnCode reset(mcsv1Context* context);
|
||||
|
||||
:param context: The context object for this call.
|
||||
@ -108,6 +114,8 @@ Callback Methods
|
||||
|
||||
Use context->getUserData() and type cast it to your UserData type or Simple Data Model stuct.
|
||||
|
||||
.. _nextvalue:
|
||||
|
||||
.. c:function:: ReturnCode nextValue(mcsv1Context* context, std::vector<ColumnDatum>& valsIn);
|
||||
|
||||
:param context: The context object for this call
|
||||
@ -128,6 +136,8 @@ Callback Methods
|
||||
|
||||
Since this is called for every row, it is important that this method be efficient.
|
||||
|
||||
.. _subevaluate:
|
||||
|
||||
.. c:function:: ReturnCode subEvaluate(mcsv1Context* context, const UserData* userDataIn);
|
||||
|
||||
:param context: The context object for this call
|
||||
@ -142,6 +152,8 @@ Callback Methods
|
||||
|
||||
Each call to subEvaluate should aggregate the values from userDataIn into the context's UserData struct.
|
||||
|
||||
.. _evaluate:
|
||||
|
||||
.. c:function:: ReturnCode evaluate(mcsv1Context* context, static_any::any& valOut);
|
||||
|
||||
:param context: The context object for this call
|
||||
@ -158,6 +170,8 @@ Callback Methods
|
||||
|
||||
Set your aggregated value into valOut. The type you set should be compatible with the type defined in the context's result type. The framework will do it's best to do any conversions if required.
|
||||
|
||||
.. _dropvalue:
|
||||
|
||||
.. c:function:: ReturnCode dropValue(mcsv1Context* context, std::vector<ColumnDatum>& valsDropped);
|
||||
|
||||
:param context: The context object for this call
|
||||
@ -182,6 +196,8 @@ Callback Methods
|
||||
Subtract the value from accumulator
|
||||
decrement row count
|
||||
|
||||
.. _createuserdata:
|
||||
|
||||
.. c:function:: ReturnCode createUserData(UserData*& userdata, int32_t& length);
|
||||
|
||||
:param userData [out]: A pointer to be allocated by the function.
|
||||
|
@ -72,9 +72,9 @@ In the MEDIAN UDAF, it works like this:
|
||||
|
||||
Notice that the data is to be stored in a std::map container.
|
||||
|
||||
The serialize method leverages Columnstore's ByteStream class (in namespace messageqcpp). This is not optional. The serialize and unserialize methods are each passed an reference to a ByteStream. The framework expects the data to be streamed into the ByteStream by serialize and streamed back into your data struct by unserialize. See the chapter on ByteStream for more information.
|
||||
The serialize method leverages Columnstore's :ref:`ByteStream <bytestream>` class (in namespace messageqcpp). This is not optional. The serialize and unserialize methods are each passed an reference to a :ref:`ByteStream <bytestream>`. The framework expects the data to be streamed into the :ref:`ByteStream <bytestream>` by serialize and streamed back into your data struct by unserialize. See the chapter on :ref:`ByteStream <bytestream>` for more information.
|
||||
|
||||
For MEDIAN, serialize() iterates over the set and streams the values to the ByteStream and unserialze unstreams them back into the set:
|
||||
For MEDIAN, serialize() iterates over the set and streams the values to the :ref:`ByteStream <bytestream>` and unserialze unstreams them back into the set:
|
||||
|
||||
.. literalinclude:: ../../../median.cpp
|
||||
:lines: 290-305
|
||||
@ -82,7 +82,7 @@ For MEDIAN, serialize() iterates over the set and streams the values to the Byte
|
||||
|
||||
.. rubric:: createUserData()
|
||||
|
||||
The createUserData() method() has two parameters, a pointer reference to userData, and a length. Both of these are [OUT] parameters.
|
||||
The :ref:`createUserData() <createuserdata>` method() has two parameters, a pointer reference to userData, and a length. Both of these are [OUT] parameters.
|
||||
|
||||
The userData parameter is to be set to an instance of your new data structure.
|
||||
|
||||
|
@ -20,7 +20,7 @@ You may only need a few accunulators and counters. These can be represented as a
|
||||
If you have a more complex data structure that may have varying size, you must use :ref:`complexdatamodel`. This should be defined in the header. Here's a struct for MEDIAN example from median.h:
|
||||
|
||||
.. literalinclude:: ../../../median.h
|
||||
:lines: 84-97
|
||||
:lines: 80-97
|
||||
:language: cpp
|
||||
|
||||
In each of the functions that have a context parameter, you should type cast the data member of context's UserData member::
|
||||
|
Reference in New Issue
Block a user