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
Reformat all code to coding standard
This commit is contained in:
@ -22,7 +22,7 @@
|
||||
*
|
||||
***********************************************************************/
|
||||
|
||||
/**
|
||||
/**
|
||||
* MariaDB ColumnStore interface for writing a user defined function (UDF).
|
||||
*
|
||||
* The basic steps are:
|
||||
@ -62,18 +62,18 @@ namespace udfsdk
|
||||
class UDFSDK
|
||||
{
|
||||
public:
|
||||
EXPORT UDFSDK();
|
||||
EXPORT UDFSDK();
|
||||
|
||||
EXPORT ~UDFSDK();
|
||||
EXPORT ~UDFSDK();
|
||||
|
||||
EXPORT funcexp::FuncMap UDFMap() const;
|
||||
EXPORT funcexp::FuncMap UDFMap() const;
|
||||
|
||||
protected:
|
||||
|
||||
private:
|
||||
//defaults okay
|
||||
//UDFSDK(const UDFSDK& rhs);
|
||||
//UDFSDK& operator=(const UDFSDK& rhs);
|
||||
//defaults okay
|
||||
//UDFSDK(const UDFSDK& rhs);
|
||||
//UDFSDK& operator=(const UDFSDK& rhs);
|
||||
|
||||
};
|
||||
|
||||
@ -85,18 +85,18 @@ private:
|
||||
* The function interface is defined here. All UDF functions are derived from
|
||||
* class funcexp::Func. A set of getXXXval interface APIs are declared in the
|
||||
* parent class Func, which will be called by IDB function and expression (F&E)
|
||||
* framwork when evaluating the function. Which API to be called depends on
|
||||
* the context of the function in the SQL query, i.e., the result type that
|
||||
* framwork when evaluating the function. Which API to be called depends on
|
||||
* the context of the function in the SQL query, i.e., the result type that
|
||||
* the function is expected to return.
|
||||
*
|
||||
* For example, given the following two queries, different APIs will be called
|
||||
* to evaluate the function MCS_add.
|
||||
*
|
||||
* select MCS_add(int1, int2) from t1;
|
||||
* select MCS_add(int1, int2) from t1;
|
||||
* getDoubleVal() is called, because the result type of MCS_add is DOUBLE(real).
|
||||
*
|
||||
* select substr(string1, int1, MCS_add(int1+int2));
|
||||
* getIntVal() will be called, because MCS_add() is passed as the third argument
|
||||
* getIntVal() will be called, because MCS_add() is passed as the third argument
|
||||
* to substr function, and an integer result is expected.
|
||||
*
|
||||
* If one API is not implemented but called for a function, IDB-5001 error will
|
||||
@ -105,126 +105,126 @@ private:
|
||||
class MCS_add : public funcexp::Func
|
||||
{
|
||||
public:
|
||||
/*
|
||||
* Constructor. Pass the function name to the base constructor.
|
||||
*/
|
||||
MCS_add() : Func("mcs_add") {}
|
||||
|
||||
/*
|
||||
* Destructor. MCS_add does not need to do anything here to clean up.
|
||||
*/
|
||||
virtual ~MCS_add() {}
|
||||
|
||||
/**
|
||||
* Decide on the function's operation type
|
||||
*
|
||||
* Operation type decides which API needs to be called for each function
|
||||
* parameter. Sometimes it is obvious. e.g. for function substr (c1, c2, c3),
|
||||
* one knows that getStrVal(), getIntVal() and getIntVal() should be called for
|
||||
* the three parameters in sequence. In that case, a dummy type can be returned
|
||||
* because it won't be used in the function implementation. Sometimes the
|
||||
* operation type is decided by the data type of the function parameters.
|
||||
* e.g., isnull(c1) function, one should call the corresponding getXXXval()
|
||||
* function that in compatible with the result type of c1.
|
||||
*
|
||||
* @parm fp vector of function parameters
|
||||
* Each element is a boost::shared_ptr of execplan::ParseTree. class
|
||||
* ParseTree is defined in ~/dbcon/execplan/parsetree.h
|
||||
* @parm resultType result type of this function
|
||||
* Sometimes it may affect the operation type, but most of the time it
|
||||
* can be ignored. Struct ColType is defined in ~/dbcon/execplan/calpontsystemcatalog.h
|
||||
* @return operation type for this function
|
||||
*
|
||||
* This function is called only one from the connector. Once it's determined, it
|
||||
* will be passed to the getXXXval() APIs during function evaluation.
|
||||
*/
|
||||
execplan::CalpontSystemCatalog::ColType operationType(funcexp::FunctionParm& fp, execplan::CalpontSystemCatalog::ColType& resultType);
|
||||
/*
|
||||
* Constructor. Pass the function name to the base constructor.
|
||||
*/
|
||||
MCS_add() : Func("mcs_add") {}
|
||||
|
||||
/**
|
||||
* Returns an integer result of this function.
|
||||
* All the getXXXvalue APIs take the same arguments. They will be called
|
||||
* for every row in the result set when the function is being evaluated.
|
||||
* So these functions needs to be efficient.
|
||||
*
|
||||
* @parm row reference of the current row
|
||||
* @parm fp function parameters
|
||||
* @parm isNull NULL indicator throughout this function evaluation.
|
||||
* the same reference is passed to all the function argument
|
||||
* evaluations. One always need to know if any argument is NULL
|
||||
* to decide the result of the function. It's explained in detail
|
||||
* in MCS_isnull() function example.
|
||||
* @parm op_ct the operation type that is determined in operationType().
|
||||
*
|
||||
*/
|
||||
virtual int64_t getIntVal(rowgroup::Row& row,
|
||||
funcexp::FunctionParm& fp,
|
||||
bool& isNull,
|
||||
execplan::CalpontSystemCatalog::ColType& op_ct);
|
||||
|
||||
/**
|
||||
* Returns a double result of this function.
|
||||
*/
|
||||
/*
|
||||
* Destructor. MCS_add does not need to do anything here to clean up.
|
||||
*/
|
||||
virtual ~MCS_add() {}
|
||||
|
||||
virtual double getDoubleVal(rowgroup::Row& row,
|
||||
funcexp::FunctionParm& fp,
|
||||
bool& isNull,
|
||||
execplan::CalpontSystemCatalog::ColType& op_ct);
|
||||
/**
|
||||
* Decide on the function's operation type
|
||||
*
|
||||
* Operation type decides which API needs to be called for each function
|
||||
* parameter. Sometimes it is obvious. e.g. for function substr (c1, c2, c3),
|
||||
* one knows that getStrVal(), getIntVal() and getIntVal() should be called for
|
||||
* the three parameters in sequence. In that case, a dummy type can be returned
|
||||
* because it won't be used in the function implementation. Sometimes the
|
||||
* operation type is decided by the data type of the function parameters.
|
||||
* e.g., isnull(c1) function, one should call the corresponding getXXXval()
|
||||
* function that in compatible with the result type of c1.
|
||||
*
|
||||
* @parm fp vector of function parameters
|
||||
* Each element is a boost::shared_ptr of execplan::ParseTree. class
|
||||
* ParseTree is defined in ~/dbcon/execplan/parsetree.h
|
||||
* @parm resultType result type of this function
|
||||
* Sometimes it may affect the operation type, but most of the time it
|
||||
* can be ignored. Struct ColType is defined in ~/dbcon/execplan/calpontsystemcatalog.h
|
||||
* @return operation type for this function
|
||||
*
|
||||
* This function is called only one from the connector. Once it's determined, it
|
||||
* will be passed to the getXXXval() APIs during function evaluation.
|
||||
*/
|
||||
execplan::CalpontSystemCatalog::ColType operationType(funcexp::FunctionParm& fp, execplan::CalpontSystemCatalog::ColType& resultType);
|
||||
|
||||
/**
|
||||
* Returns a float result of this function.
|
||||
*/
|
||||
virtual float getFloatVal(rowgroup::Row& row,
|
||||
funcexp::FunctionParm& fp,
|
||||
bool& isNull,
|
||||
execplan::CalpontSystemCatalog::ColType& op_ct);
|
||||
|
||||
/**
|
||||
* Returns a string result of this function.
|
||||
*/
|
||||
virtual std::string getStrVal(rowgroup::Row& row,
|
||||
funcexp::FunctionParm& fp,
|
||||
bool& isNull,
|
||||
execplan::CalpontSystemCatalog::ColType& op_ct);
|
||||
|
||||
/**
|
||||
* Returns a bool result of this function.
|
||||
*/
|
||||
virtual bool getBoolVal(rowgroup::Row& row,
|
||||
funcexp::FunctionParm& fp,
|
||||
bool& isNull,
|
||||
execplan::CalpontSystemCatalog::ColType& op_ct);
|
||||
|
||||
/**
|
||||
* Returns a decimal result of this function.
|
||||
*
|
||||
* IDB_Decimal is defined in ~/execplan/treenode.h
|
||||
*/
|
||||
virtual execplan::IDB_Decimal getDecimalVal(rowgroup::Row& row,
|
||||
funcexp::FunctionParm& fp,
|
||||
bool& isNull,
|
||||
execplan::CalpontSystemCatalog::ColType& op_ct);
|
||||
|
||||
/**
|
||||
* Returns an integer representation of a date result of the function.
|
||||
*
|
||||
* Check the date/time functions in ~/utils/funcexp for implementation
|
||||
* example of this API.
|
||||
*/
|
||||
virtual int32_t getDateIntVal(rowgroup::Row& row,
|
||||
funcexp::FunctionParm& fp,
|
||||
bool& isNull,
|
||||
execplan::CalpontSystemCatalog::ColType& op_ct);
|
||||
|
||||
/**
|
||||
* Returns an integer representation of a datetime result of the function.
|
||||
*
|
||||
* Check the date/time functions in ~/utils/funcexp for implementation
|
||||
* example of this API.
|
||||
*/
|
||||
virtual int64_t getDatetimeIntVal(rowgroup::Row& row,
|
||||
funcexp::FunctionParm& fp,
|
||||
bool& isNull,
|
||||
execplan::CalpontSystemCatalog::ColType& op_ct);
|
||||
/**
|
||||
* Returns an integer result of this function.
|
||||
* All the getXXXvalue APIs take the same arguments. They will be called
|
||||
* for every row in the result set when the function is being evaluated.
|
||||
* So these functions needs to be efficient.
|
||||
*
|
||||
* @parm row reference of the current row
|
||||
* @parm fp function parameters
|
||||
* @parm isNull NULL indicator throughout this function evaluation.
|
||||
* the same reference is passed to all the function argument
|
||||
* evaluations. One always need to know if any argument is NULL
|
||||
* to decide the result of the function. It's explained in detail
|
||||
* in MCS_isnull() function example.
|
||||
* @parm op_ct the operation type that is determined in operationType().
|
||||
*
|
||||
*/
|
||||
virtual int64_t getIntVal(rowgroup::Row& row,
|
||||
funcexp::FunctionParm& fp,
|
||||
bool& isNull,
|
||||
execplan::CalpontSystemCatalog::ColType& op_ct);
|
||||
|
||||
/**
|
||||
* Returns a double result of this function.
|
||||
*/
|
||||
|
||||
virtual double getDoubleVal(rowgroup::Row& row,
|
||||
funcexp::FunctionParm& fp,
|
||||
bool& isNull,
|
||||
execplan::CalpontSystemCatalog::ColType& op_ct);
|
||||
|
||||
/**
|
||||
* Returns a float result of this function.
|
||||
*/
|
||||
virtual float getFloatVal(rowgroup::Row& row,
|
||||
funcexp::FunctionParm& fp,
|
||||
bool& isNull,
|
||||
execplan::CalpontSystemCatalog::ColType& op_ct);
|
||||
|
||||
/**
|
||||
* Returns a string result of this function.
|
||||
*/
|
||||
virtual std::string getStrVal(rowgroup::Row& row,
|
||||
funcexp::FunctionParm& fp,
|
||||
bool& isNull,
|
||||
execplan::CalpontSystemCatalog::ColType& op_ct);
|
||||
|
||||
/**
|
||||
* Returns a bool result of this function.
|
||||
*/
|
||||
virtual bool getBoolVal(rowgroup::Row& row,
|
||||
funcexp::FunctionParm& fp,
|
||||
bool& isNull,
|
||||
execplan::CalpontSystemCatalog::ColType& op_ct);
|
||||
|
||||
/**
|
||||
* Returns a decimal result of this function.
|
||||
*
|
||||
* IDB_Decimal is defined in ~/execplan/treenode.h
|
||||
*/
|
||||
virtual execplan::IDB_Decimal getDecimalVal(rowgroup::Row& row,
|
||||
funcexp::FunctionParm& fp,
|
||||
bool& isNull,
|
||||
execplan::CalpontSystemCatalog::ColType& op_ct);
|
||||
|
||||
/**
|
||||
* Returns an integer representation of a date result of the function.
|
||||
*
|
||||
* Check the date/time functions in ~/utils/funcexp for implementation
|
||||
* example of this API.
|
||||
*/
|
||||
virtual int32_t getDateIntVal(rowgroup::Row& row,
|
||||
funcexp::FunctionParm& fp,
|
||||
bool& isNull,
|
||||
execplan::CalpontSystemCatalog::ColType& op_ct);
|
||||
|
||||
/**
|
||||
* Returns an integer representation of a datetime result of the function.
|
||||
*
|
||||
* Check the date/time functions in ~/utils/funcexp for implementation
|
||||
* example of this API.
|
||||
*/
|
||||
virtual int64_t getDatetimeIntVal(rowgroup::Row& row,
|
||||
funcexp::FunctionParm& fp,
|
||||
bool& isNull,
|
||||
execplan::CalpontSystemCatalog::ColType& op_ct);
|
||||
};
|
||||
|
||||
/**
|
||||
@ -235,92 +235,92 @@ public:
|
||||
class MCS_isnull : public funcexp::Func
|
||||
{
|
||||
public:
|
||||
/*
|
||||
* Constructor. Pass the function name to the base constructor.
|
||||
*/
|
||||
MCS_isnull() : Func("mcs_isnull") {}
|
||||
|
||||
/*
|
||||
* Destructor. MCS_add does not need to do anything here to clean up.
|
||||
*/
|
||||
virtual ~MCS_isnull() {}
|
||||
|
||||
/**
|
||||
* Decide on the function's operation type
|
||||
*/
|
||||
execplan::CalpontSystemCatalog::ColType operationType(funcexp::FunctionParm& fp, execplan::CalpontSystemCatalog::ColType& resultType);
|
||||
/*
|
||||
* Constructor. Pass the function name to the base constructor.
|
||||
*/
|
||||
MCS_isnull() : Func("mcs_isnull") {}
|
||||
|
||||
/**
|
||||
* Returns an integer result of this function.
|
||||
*/
|
||||
virtual int64_t getIntVal(rowgroup::Row& row,
|
||||
funcexp::FunctionParm& fp,
|
||||
bool& isNull,
|
||||
execplan::CalpontSystemCatalog::ColType& op_ct);
|
||||
|
||||
/**
|
||||
* Returns a double result of this function.
|
||||
*/
|
||||
virtual double getDoubleVal(rowgroup::Row& row,
|
||||
funcexp::FunctionParm& fp,
|
||||
bool& isNull,
|
||||
execplan::CalpontSystemCatalog::ColType& op_ct);
|
||||
/*
|
||||
* Destructor. MCS_add does not need to do anything here to clean up.
|
||||
*/
|
||||
virtual ~MCS_isnull() {}
|
||||
|
||||
/**
|
||||
* Returns a float result of this function.
|
||||
*/
|
||||
virtual float getFloatVal(rowgroup::Row& row,
|
||||
funcexp::FunctionParm& fp,
|
||||
bool& isNull,
|
||||
execplan::CalpontSystemCatalog::ColType& op_ct);
|
||||
|
||||
/**
|
||||
* Returns a string result of this function.
|
||||
*/
|
||||
virtual std::string getStrVal(rowgroup::Row& row,
|
||||
funcexp::FunctionParm& fp,
|
||||
bool& isNull,
|
||||
execplan::CalpontSystemCatalog::ColType& op_ct);
|
||||
|
||||
/**
|
||||
* Returns a bool result of this function.
|
||||
*/
|
||||
virtual bool getBoolVal(rowgroup::Row& row,
|
||||
funcexp::FunctionParm& fp,
|
||||
bool& isNull,
|
||||
execplan::CalpontSystemCatalog::ColType& op_ct);
|
||||
|
||||
/**
|
||||
* Returns a decimal result of this function.
|
||||
*
|
||||
* IDB_Decimal is defined in ~/execplan/treenode.h
|
||||
*/
|
||||
virtual execplan::IDB_Decimal getDecimalVal(rowgroup::Row& row,
|
||||
funcexp::FunctionParm& fp,
|
||||
bool& isNull,
|
||||
execplan::CalpontSystemCatalog::ColType& op_ct);
|
||||
/**
|
||||
* Decide on the function's operation type
|
||||
*/
|
||||
execplan::CalpontSystemCatalog::ColType operationType(funcexp::FunctionParm& fp, execplan::CalpontSystemCatalog::ColType& resultType);
|
||||
|
||||
/**
|
||||
* Returns an integer representation of a date result of the function.
|
||||
*
|
||||
* Check the date/time functions in ~/utils/funcexp for implementation
|
||||
* example of this API.
|
||||
*/
|
||||
virtual int32_t getDateIntVal(rowgroup::Row& row,
|
||||
funcexp::FunctionParm& fp,
|
||||
bool& isNull,
|
||||
execplan::CalpontSystemCatalog::ColType& op_ct);
|
||||
|
||||
/**
|
||||
* Returns an integer representation of a datetime result of the function.
|
||||
*
|
||||
* Check the date/time functions in ~/utils/funcexp for implementation
|
||||
* example of this API.
|
||||
*/
|
||||
virtual int64_t getDatetimeIntVal(rowgroup::Row& row,
|
||||
funcexp::FunctionParm& fp,
|
||||
bool& isNull,
|
||||
execplan::CalpontSystemCatalog::ColType& op_ct);
|
||||
/**
|
||||
* Returns an integer result of this function.
|
||||
*/
|
||||
virtual int64_t getIntVal(rowgroup::Row& row,
|
||||
funcexp::FunctionParm& fp,
|
||||
bool& isNull,
|
||||
execplan::CalpontSystemCatalog::ColType& op_ct);
|
||||
|
||||
/**
|
||||
* Returns a double result of this function.
|
||||
*/
|
||||
virtual double getDoubleVal(rowgroup::Row& row,
|
||||
funcexp::FunctionParm& fp,
|
||||
bool& isNull,
|
||||
execplan::CalpontSystemCatalog::ColType& op_ct);
|
||||
|
||||
/**
|
||||
* Returns a float result of this function.
|
||||
*/
|
||||
virtual float getFloatVal(rowgroup::Row& row,
|
||||
funcexp::FunctionParm& fp,
|
||||
bool& isNull,
|
||||
execplan::CalpontSystemCatalog::ColType& op_ct);
|
||||
|
||||
/**
|
||||
* Returns a string result of this function.
|
||||
*/
|
||||
virtual std::string getStrVal(rowgroup::Row& row,
|
||||
funcexp::FunctionParm& fp,
|
||||
bool& isNull,
|
||||
execplan::CalpontSystemCatalog::ColType& op_ct);
|
||||
|
||||
/**
|
||||
* Returns a bool result of this function.
|
||||
*/
|
||||
virtual bool getBoolVal(rowgroup::Row& row,
|
||||
funcexp::FunctionParm& fp,
|
||||
bool& isNull,
|
||||
execplan::CalpontSystemCatalog::ColType& op_ct);
|
||||
|
||||
/**
|
||||
* Returns a decimal result of this function.
|
||||
*
|
||||
* IDB_Decimal is defined in ~/execplan/treenode.h
|
||||
*/
|
||||
virtual execplan::IDB_Decimal getDecimalVal(rowgroup::Row& row,
|
||||
funcexp::FunctionParm& fp,
|
||||
bool& isNull,
|
||||
execplan::CalpontSystemCatalog::ColType& op_ct);
|
||||
|
||||
/**
|
||||
* Returns an integer representation of a date result of the function.
|
||||
*
|
||||
* Check the date/time functions in ~/utils/funcexp for implementation
|
||||
* example of this API.
|
||||
*/
|
||||
virtual int32_t getDateIntVal(rowgroup::Row& row,
|
||||
funcexp::FunctionParm& fp,
|
||||
bool& isNull,
|
||||
execplan::CalpontSystemCatalog::ColType& op_ct);
|
||||
|
||||
/**
|
||||
* Returns an integer representation of a datetime result of the function.
|
||||
*
|
||||
* Check the date/time functions in ~/utils/funcexp for implementation
|
||||
* example of this API.
|
||||
*/
|
||||
virtual int64_t getDatetimeIntVal(rowgroup::Row& row,
|
||||
funcexp::FunctionParm& fp,
|
||||
bool& isNull,
|
||||
execplan::CalpontSystemCatalog::ColType& op_ct);
|
||||
};
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user