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
Reformat all code to coding standard
This commit is contained in:
@ -43,62 +43,78 @@
|
||||
|
||||
#include "joblistfactory.h"
|
||||
|
||||
namespace joblist {
|
||||
namespace joblist
|
||||
{
|
||||
class DistributedEngineComm;
|
||||
}
|
||||
|
||||
namespace ddlpackageprocessor
|
||||
{
|
||||
|
||||
/** @brief Populate an new Index
|
||||
/** @brief Populate an new Index
|
||||
* implementation of a DDLPopulator
|
||||
*/
|
||||
class DDLIndexPopulator
|
||||
class DDLIndexPopulator
|
||||
{
|
||||
|
||||
public:
|
||||
/** @brief constructor
|
||||
*
|
||||
*/
|
||||
DDLIndexPopulator(WriteEngine::WriteEngineWrapper* writeEngine,
|
||||
execplan::SessionManager* sessionManager,
|
||||
uint32_t sessionID,
|
||||
execplan::CalpontSystemCatalog::SCN txnID,
|
||||
DDLPackageProcessor::DDLResult& result,
|
||||
const DDLPackageProcessor::IndexOID& idxOID,
|
||||
const ddlpackage::ColumnNameList& colNames,
|
||||
const ddlpackage::QualifiedName& table,
|
||||
const ddlpackage::DDL_CONSTRAINTS constraint,
|
||||
const DDLPackageProcessor::DebugLevel debug):
|
||||
fWriteEngine(writeEngine), fSessionManager(sessionManager),
|
||||
fSessionID(sessionID), fTxnID(txnID), fResult(result),
|
||||
fIdxOID(idxOID), fColNames(colNames), fTable(table), fDebugLevel(debug),
|
||||
fEC(0), fRidList(), fIdxStructList(), fIdxValueList(),
|
||||
/* fTOKENSIZE(sizeof(WriteEngine::Token) ) {}*/
|
||||
fConstraint(constraint), fUniqueColResultList() {}
|
||||
|
||||
/** @brief constructor
|
||||
*
|
||||
*/
|
||||
DDLIndexPopulator(WriteEngine::WriteEngineWrapper* writeEngine,
|
||||
execplan::SessionManager* sessionManager,
|
||||
uint32_t sessionID,
|
||||
execplan::CalpontSystemCatalog::SCN txnID,
|
||||
DDLPackageProcessor::DDLResult& result,
|
||||
const DDLPackageProcessor::IndexOID& idxOID,
|
||||
const ddlpackage::ColumnNameList& colNames,
|
||||
const ddlpackage::QualifiedName& table,
|
||||
const ddlpackage::DDL_CONSTRAINTS constraint,
|
||||
const DDLPackageProcessor::DebugLevel debug):
|
||||
fWriteEngine(writeEngine), fSessionManager(sessionManager),
|
||||
fSessionID(sessionID), fTxnID(txnID), fResult(result),
|
||||
fIdxOID(idxOID), fColNames(colNames), fTable(table), fDebugLevel(debug),
|
||||
fEC(0), fRidList(), fIdxStructList(), fIdxValueList(),
|
||||
/* fTOKENSIZE(sizeof(WriteEngine::Token) ) {}*/
|
||||
fConstraint(constraint), fUniqueColResultList() {}
|
||||
|
||||
|
||||
/** @brief destructor
|
||||
*/
|
||||
virtual ~DDLIndexPopulator() { };
|
||||
|
||||
|
||||
|
||||
|
||||
/** @brief Is it required to debug
|
||||
*/
|
||||
const bool isDebug( const DDLPackageProcessor::DebugLevel level ) const { return level <= fDebugLevel; }
|
||||
|
||||
const bool isDebug( const DDLPackageProcessor::DebugLevel level ) const
|
||||
{
|
||||
return level <= fDebugLevel;
|
||||
}
|
||||
|
||||
/** @brief Get debug level
|
||||
*/
|
||||
const DDLPackageProcessor::DebugLevel getDebugLevel() const { return fDebugLevel; }
|
||||
|
||||
|
||||
const DDLPackageProcessor::DebugLevel getDebugLevel() const
|
||||
{
|
||||
return fDebugLevel;
|
||||
}
|
||||
|
||||
|
||||
/** @brief set distributedEngineComm pointer ( for
|
||||
* loading index).
|
||||
*/
|
||||
void setEngineComm(joblist::DistributedEngineComm* ec) { fEC = ec; }
|
||||
void setIdxOID(const DDLPackageProcessor::IndexOID& idxOID) { fIdxOID = idxOID; }
|
||||
|
||||
DDLPackageProcessor::DDLResult getResult() const { return fResult; }
|
||||
void setEngineComm(joblist::DistributedEngineComm* ec)
|
||||
{
|
||||
fEC = ec;
|
||||
}
|
||||
void setIdxOID(const DDLPackageProcessor::IndexOID& idxOID)
|
||||
{
|
||||
fIdxOID = idxOID;
|
||||
}
|
||||
|
||||
DDLPackageProcessor::DDLResult getResult() const
|
||||
{
|
||||
return fResult;
|
||||
}
|
||||
|
||||
|
||||
/** @brief add data to the index from the statement
|
||||
@ -107,16 +123,16 @@ public:
|
||||
* returns if there was an error.
|
||||
*/
|
||||
bool populateIndex(DDLPackageProcessor::DDLResult& result);
|
||||
/** @brief returns if dictionary type
|
||||
/** @brief returns if dictionary type
|
||||
*
|
||||
* determines if coltype is dictionary type based on type and size
|
||||
*/
|
||||
bool isDictionaryType(const execplan::CalpontSystemCatalog::ColType& ctype);
|
||||
bool isDictionaryType(const execplan::CalpontSystemCatalog::ColType& ctype);
|
||||
|
||||
void setConstraint(ddlpackage::DDL_CONSTRAINTS constraint);
|
||||
|
||||
protected:
|
||||
|
||||
protected:
|
||||
|
||||
/** @brief make the structures to update the index
|
||||
*
|
||||
* builds and executes a query to retrieve all the data from the index columns
|
||||
@ -131,7 +147,7 @@ public:
|
||||
* the WriteEngine::IdxStruct
|
||||
*/
|
||||
execplan::CalpontSystemCatalog::ColType makeIdxStruct(const execplan::ColumnResult* cr, size_t cols, boost::shared_ptr<execplan::CalpontSystemCatalog> csc );
|
||||
|
||||
|
||||
/** @brief add the column result data to the value list
|
||||
*
|
||||
* Check contraints on each data item and adds it to a tuple list.
|
||||
@ -142,15 +158,15 @@ public:
|
||||
|
||||
/** @brief insert data into index.
|
||||
*
|
||||
* updates the index with the data using the appropriate write engine method
|
||||
* updates the index with the data using the appropriate write engine method
|
||||
* based on multi column. Sets result to error if there is one.
|
||||
*/
|
||||
void insertIndex();
|
||||
|
||||
void insertIndex();
|
||||
|
||||
private:
|
||||
DDLIndexPopulator(const DDLIndexPopulator& );
|
||||
void operator=(const DDLIndexPopulator& );
|
||||
|
||||
private:
|
||||
DDLIndexPopulator(const DDLIndexPopulator& );
|
||||
void operator=(const DDLIndexPopulator& );
|
||||
/** @brief makes Calpont Select Execution Plan
|
||||
*
|
||||
* builds csep to select data from all columns from fColNames
|
||||
@ -165,12 +181,12 @@ public:
|
||||
|
||||
bool isStringType(int type) const
|
||||
{
|
||||
return (type == execplan::CalpontSystemCatalog::CHAR
|
||||
|| type == execplan::CalpontSystemCatalog::VARCHAR
|
||||
|| type == execplan::CalpontSystemCatalog::FLOAT
|
||||
|| type == execplan::CalpontSystemCatalog::DOUBLE
|
||||
|| type == execplan::CalpontSystemCatalog::UFLOAT
|
||||
|| type == execplan::CalpontSystemCatalog::UDOUBLE );
|
||||
return (type == execplan::CalpontSystemCatalog::CHAR
|
||||
|| type == execplan::CalpontSystemCatalog::VARCHAR
|
||||
|| type == execplan::CalpontSystemCatalog::FLOAT
|
||||
|| type == execplan::CalpontSystemCatalog::DOUBLE
|
||||
|| type == execplan::CalpontSystemCatalog::UFLOAT
|
||||
|| type == execplan::CalpontSystemCatalog::UDOUBLE );
|
||||
}
|
||||
|
||||
/** @brief converts column result data
|
||||
@ -182,32 +198,32 @@ public:
|
||||
/** @brief converts non token data to its original type
|
||||
*/
|
||||
boost::any convertData(const execplan::CalpontSystemCatalog::ColType& colType, const execplan::ColumnResult* cr, int idx );
|
||||
|
||||
/** @brief returns token for string data
|
||||
*
|
||||
* There are two methods, the one using the rid is a workaround.
|
||||
* Use the method that passes string data when WriteEngine::tokenize is
|
||||
* able to return an existing token for a string. The rid method reads
|
||||
* the column file directly.
|
||||
*/
|
||||
|
||||
/** @brief returns token for string data
|
||||
*
|
||||
* There are two methods, the one using the rid is a workaround.
|
||||
* Use the method that passes string data when WriteEngine::tokenize is
|
||||
* able to return an existing token for a string. The rid method reads
|
||||
* the column file directly.
|
||||
*/
|
||||
boost::any tokenizeData( const execplan::CalpontSystemCatalog::ColType& colType, const std::string& data );
|
||||
|
||||
boost::any tokenizeData( WriteEngine::RID rid );
|
||||
|
||||
/** @brief convert token data
|
||||
*
|
||||
* Indexes will use the first 8 bytes of a token type value instead
|
||||
* of a token.
|
||||
*/
|
||||
/** @brief convert token data
|
||||
*
|
||||
* Indexes will use the first 8 bytes of a token type value instead
|
||||
* of a token.
|
||||
*/
|
||||
|
||||
boost::any convertTokenData( const std::string& data );
|
||||
|
||||
/** @brief opens the column file for the oid
|
||||
*
|
||||
* This method is needed only as long as the class is using the rid
|
||||
* tokenizeData method. The fColumnFile and this method are no longer
|
||||
* needed when the WriteEngine::tokenize method can be used.
|
||||
*/
|
||||
/** @brief opens the column file for the oid
|
||||
*
|
||||
* This method is needed only as long as the class is using the rid
|
||||
* tokenizeData method. The fColumnFile and this method are no longer
|
||||
* needed when the WriteEngine::tokenize method can be used.
|
||||
*/
|
||||
//bool openColumnFile(WriteEngine::OID oid);
|
||||
|
||||
/** @brief returns if data violated its constraint
|
||||
@ -215,7 +231,7 @@ public:
|
||||
* checks data according to contraint in coltype and sets result to error
|
||||
* if constraint violated. Returns if no error.
|
||||
*/
|
||||
bool checkConstraints(const WriteEngine::IdxTuple& data, const execplan::CalpontSystemCatalog::ColType& ctype, int i, int column);
|
||||
bool checkConstraints(const WriteEngine::IdxTuple& data, const execplan::CalpontSystemCatalog::ColType& ctype, int i, int column);
|
||||
|
||||
/** @brief returns if data not null
|
||||
*
|
||||
@ -229,19 +245,25 @@ public:
|
||||
*/
|
||||
bool checkUnique(int i, const execplan::CalpontSystemCatalog::ColType& colType );
|
||||
|
||||
bool checkCheck( const WriteEngine::IdxTuple& data, const execplan::CalpontSystemCatalog::ColType& ctype) const { return true; }
|
||||
bool checkCheck( const WriteEngine::IdxTuple& data, const execplan::CalpontSystemCatalog::ColType& ctype) const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool isUnique() { return ddlpackage::DDL_PRIMARY_KEY == fConstraint || ddlpackage::DDL_UNIQUE == fConstraint; }
|
||||
bool isUnique()
|
||||
{
|
||||
return ddlpackage::DDL_PRIMARY_KEY == fConstraint || ddlpackage::DDL_UNIQUE == fConstraint;
|
||||
}
|
||||
/** @brief logs error and message
|
||||
*
|
||||
* Updates result with message and sets it to CREATE_ERROR
|
||||
*/
|
||||
void logError(const std::string& msg, int error = 0);
|
||||
void logError(const std::string& msg, int error = 0);
|
||||
|
||||
bool compareToken(const WriteEngine::Token& first, const WriteEngine::Token& second) const
|
||||
{
|
||||
return (first.op == second.op && first.fbo == second.fbo && first.spare == second.spare);
|
||||
}
|
||||
return (first.op == second.op && first.fbo == second.fbo && first.spare == second.spare);
|
||||
}
|
||||
|
||||
WriteEngine::WriteEngineWrapper* fWriteEngine;
|
||||
execplan::SessionManager* fSessionManager;
|
||||
@ -251,8 +273,8 @@ public:
|
||||
DDLPackageProcessor::IndexOID fIdxOID;
|
||||
ddlpackage::ColumnNameList fColNames;
|
||||
ddlpackage::QualifiedName fTable;
|
||||
DDLPackageProcessor::DebugLevel fDebugLevel;
|
||||
joblist::DistributedEngineComm* fEC;
|
||||
DDLPackageProcessor::DebugLevel fDebugLevel;
|
||||
joblist::DistributedEngineComm* fEC;
|
||||
WriteEngine::RIDList fRidList;
|
||||
WriteEngine::IdxStructList fIdxStructList;
|
||||
WriteEngine::IdxValueList fIdxValueList;
|
||||
@ -265,16 +287,16 @@ public:
|
||||
|
||||
struct DDLNullValueForType : DDLPackageProcessor
|
||||
{
|
||||
DDLNullValueForType(const execplan::CalpontSystemCatalog::ColType& ctype)
|
||||
: DDLPackageProcessor(), fType(ctype) {}
|
||||
boost::any operator()(execplan::CalpontSystemCatalog::ColType& ctype)
|
||||
{
|
||||
return getNullValueForType(fType);
|
||||
}
|
||||
const execplan::CalpontSystemCatalog::ColType& fType;
|
||||
DDLNullValueForType(const execplan::CalpontSystemCatalog::ColType& ctype)
|
||||
: DDLPackageProcessor(), fType(ctype) {}
|
||||
boost::any operator()(execplan::CalpontSystemCatalog::ColType& ctype)
|
||||
{
|
||||
return getNullValueForType(fType);
|
||||
}
|
||||
const execplan::CalpontSystemCatalog::ColType& fType;
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
#endif //DDLPINDEXPOPULATOR_H
|
||||
|
Reference in New Issue
Block a user