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:
@ -31,14 +31,14 @@
|
||||
#include "we_columninfo.h"
|
||||
#include "calpontsystemcatalog.h"
|
||||
|
||||
namespace WriteEngine
|
||||
namespace WriteEngine
|
||||
{
|
||||
class Log;
|
||||
|
||||
// Used to collect stats about a BulkLoadBuffer buffer that is being parsed
|
||||
class BLBufferStats
|
||||
{
|
||||
public:
|
||||
public:
|
||||
int64_t minBufferVal;
|
||||
int64_t maxBufferVal;
|
||||
int64_t satCount;
|
||||
@ -59,16 +59,16 @@ class BLBufferStats
|
||||
|
||||
class BulkLoadBuffer
|
||||
{
|
||||
private:
|
||||
private:
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Private Data Members
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
char *fData; // Buffer with data read from tbl file
|
||||
char *fDataParser; // for temporary use by parser
|
||||
char* fData; // Buffer with data read from tbl file
|
||||
char* fDataParser; // for temporary use by parser
|
||||
|
||||
char *fOverflowBuf; // Overflow data held for next buffer
|
||||
char* fOverflowBuf; // Overflow data held for next buffer
|
||||
unsigned fOverflowSize; // Current size of fOverflowBuf
|
||||
|
||||
// Information about the locker and status for each column in this buffer.
|
||||
@ -88,38 +88,38 @@ private:
|
||||
unsigned fParseComplete; // Num of columns that are parseComplete
|
||||
|
||||
unsigned fTotalRows; // Max rows this buffer can now hold;
|
||||
// size of fTokens array
|
||||
std::vector< std::pair<RID,std::string> > fRowStatus;//Status of bad rows
|
||||
// size of fTokens array
|
||||
std::vector< std::pair<RID, std::string> > fRowStatus; //Status of bad rows
|
||||
std::vector<std::string> fErrRows; // Rejected rows to write to .bad file
|
||||
|
||||
uint32_t fTotalReadRows; // Total valid rows read into buffer;
|
||||
// this count excludes rejected rows
|
||||
// this count excludes rejected rows
|
||||
uint32_t fTotalReadRowsParser; // for temporary use by parser
|
||||
|
||||
uint32_t fTotalReadRowsForLog; // Total rows read into this buffer
|
||||
// including invalid rows
|
||||
// including invalid rows
|
||||
|
||||
RID fStartRow; // Starting row id for rows in buffer,
|
||||
// relative to start of job.
|
||||
// Rejected rows are excluded.
|
||||
// relative to start of job.
|
||||
// Rejected rows are excluded.
|
||||
RID fStartRowParser; // for temporary use by parser
|
||||
|
||||
RID fStartRowForLogging; // Starting row id for rows in buffer,
|
||||
// relative to start of current input
|
||||
// file. All rows are counted.
|
||||
// relative to start of current input
|
||||
// file. All rows are counted.
|
||||
RID fStartRowForLoggingParser; // for temporary use by parser
|
||||
|
||||
uint32_t fAutoIncGenCount; // How many auto-increment values are
|
||||
// to be generated for current buffer
|
||||
// to be generated for current buffer
|
||||
uint32_t fAutoIncGenCountParser; // for temporary use by parser
|
||||
|
||||
uint64_t fAutoIncNextValue; // Next auto-increment value assign to
|
||||
// a row in this buffer
|
||||
// a row in this buffer
|
||||
unsigned fNumberOfColumns; // Number of ColumnInfo objs in table
|
||||
|
||||
ColPosPair **fTokens; // Vector of start and offsets for the
|
||||
// column values read from tbl files
|
||||
ColPosPair **fTokensParser; // for temporary use by parser
|
||||
ColPosPair** fTokens; // Vector of start and offsets for the
|
||||
// column values read from tbl files
|
||||
ColPosPair** fTokensParser; // for temporary use by parser
|
||||
|
||||
char fColDelim; // Character to delimit columns in a row
|
||||
unsigned fBufferSize; // Size of input read buffer (fData)
|
||||
@ -127,16 +127,16 @@ private:
|
||||
boost::mutex fSyncUpdatesBLB; // Mutex to synchronize updates
|
||||
Log* fLog; // Logger object
|
||||
bool fNullStringMode; // Indicates if "NULL" string is to be
|
||||
// treated as a NULL value or not
|
||||
// treated as a NULL value or not
|
||||
char fEnclosedByChar; // Optional char to enclose col values
|
||||
char fEscapeChar; // Used to escape enclosed character
|
||||
int fBufferId; // Id for this read buffer
|
||||
std::string fTableName; // Table assigned to this read buffer
|
||||
JobFieldRefList fFieldList; // Complete list of cols and flds
|
||||
unsigned int fNumFieldsInFile; // Number of fields in input file
|
||||
// (including fields to be ignored)
|
||||
// (including fields to be ignored)
|
||||
unsigned int fNumColsInFile; // Number of flds in input file targeted
|
||||
// for db cols (omits default cols)
|
||||
// for db cols (omits default cols)
|
||||
bool fbTruncationAsError; // Treat string truncation as error
|
||||
ImportDataMode fImportDataMode; // Import data in text or binary mode
|
||||
unsigned int fFixedBinaryRecLen; // Fixed rec len used in binary mode
|
||||
@ -147,26 +147,26 @@ private:
|
||||
|
||||
/** @brief Copy constructor
|
||||
*/
|
||||
BulkLoadBuffer(const BulkLoadBuffer &buffer);
|
||||
BulkLoadBuffer(const BulkLoadBuffer& buffer);
|
||||
|
||||
/** @brief Assignment operator
|
||||
*/
|
||||
BulkLoadBuffer & operator =(const BulkLoadBuffer & buffer);
|
||||
BulkLoadBuffer& operator =(const BulkLoadBuffer& buffer);
|
||||
|
||||
/** @brief Convert the buffer data depending upon the data type
|
||||
*/
|
||||
void convert(char *field, int fieldLength,
|
||||
bool nullFlag, unsigned char *output,
|
||||
const JobColumn & column,
|
||||
void convert(char* field, int fieldLength,
|
||||
bool nullFlag, unsigned char* output,
|
||||
const JobColumn& column,
|
||||
BLBufferStats& bufStats);
|
||||
|
||||
/** @brief Copy the overflow data
|
||||
*/
|
||||
void copyOverflow(const BulkLoadBuffer & buffer);
|
||||
void copyOverflow(const BulkLoadBuffer& buffer);
|
||||
|
||||
/** @brief Parse a Read buffer for a nonDictionary column
|
||||
*/
|
||||
int parseCol(ColumnInfo &columnInfo);
|
||||
int parseCol(ColumnInfo& columnInfo);
|
||||
|
||||
/** @brief Parse a Read buffer for a nonDictionary column
|
||||
*/
|
||||
@ -177,10 +177,10 @@ private:
|
||||
|
||||
/** @brief Parse a Read buffer for a Dictionary column
|
||||
*/
|
||||
int parseDict(ColumnInfo &columnInfo);
|
||||
int parseDict(ColumnInfo& columnInfo);
|
||||
|
||||
/** @brief Parse a Dictionary Read buffer into a ColumnBufferSection.
|
||||
*
|
||||
*
|
||||
* Parses the Read buffer into a section up to the point at which
|
||||
* the buffer crosses an extent boundary.
|
||||
*
|
||||
@ -191,7 +191,7 @@ private:
|
||||
* @param totalReadRows Number of buffer rows ready to be parsed
|
||||
* @param nRowsParsed Number of buffer rows that were parsed
|
||||
*/
|
||||
int parseDictSection(ColumnInfo &columnInfo, int tokenPos,
|
||||
int parseDictSection(ColumnInfo& columnInfo, int tokenPos,
|
||||
RID startRow, uint32_t totalReadRows,
|
||||
uint32_t& nRowsParsed);
|
||||
|
||||
@ -207,13 +207,13 @@ private:
|
||||
/** @brief Binary tokenization of the buffer, and fill up the token array.
|
||||
*/
|
||||
int tokenizeBinary(const boost::ptr_vector<ColumnInfo>& columnsInfo,
|
||||
unsigned int allowedErrCntThisCall,
|
||||
bool bEndOfData);
|
||||
unsigned int allowedErrCntThisCall,
|
||||
bool bEndOfData);
|
||||
|
||||
/** @brief Determine if specified value is NULL or not.
|
||||
*/
|
||||
bool isBinaryFieldNull(void* val, WriteEngine::ColType ct,
|
||||
execplan::CalpontSystemCatalog::ColDataType dt);
|
||||
execplan::CalpontSystemCatalog::ColDataType dt);
|
||||
|
||||
public:
|
||||
|
||||
@ -239,93 +239,128 @@ public:
|
||||
void reset();
|
||||
|
||||
/** @brief Resets the column locks.
|
||||
* TableInfo::fSyncUpdatesTI mutex should be locked when calling this
|
||||
* TableInfo::fSyncUpdatesTI mutex should be locked when calling this
|
||||
* function (see fColumnLocks discussion).
|
||||
*/
|
||||
void resetColumnLocks();
|
||||
|
||||
/** @brief Get the buffer status
|
||||
*/
|
||||
Status getStatusBLB() const {return fStatusBLB;}
|
||||
Status getStatusBLB() const
|
||||
{
|
||||
return fStatusBLB;
|
||||
}
|
||||
|
||||
/** @brief Set the buffer status
|
||||
*/
|
||||
void setStatusBLB(const Status & status){fStatusBLB = status;}
|
||||
void setStatusBLB(const Status& status)
|
||||
{
|
||||
fStatusBLB = status;
|
||||
}
|
||||
|
||||
/** @brief Try to lock a column for the buffer
|
||||
* TableInfo::fSyncUpdatesTI mutex should be locked when calling this
|
||||
* TableInfo::fSyncUpdatesTI mutex should be locked when calling this
|
||||
* function (see fColumnLocks discussion).
|
||||
*/
|
||||
bool tryAndLockColumn(const int & columnId, const int & id);
|
||||
bool tryAndLockColumn(const int& columnId, const int& id);
|
||||
|
||||
/** @brief Read the table data into the buffer
|
||||
*/
|
||||
int fillFromFile(const BulkLoadBuffer& overFlowBufIn,
|
||||
FILE * handle, RID & totalRows, RID & correctTotalRows,
|
||||
const boost::ptr_vector<ColumnInfo>& columnsInfo,
|
||||
unsigned int allowedErrCntThisCall);
|
||||
FILE* handle, RID& totalRows, RID& correctTotalRows,
|
||||
const boost::ptr_vector<ColumnInfo>& columnsInfo,
|
||||
unsigned int allowedErrCntThisCall);
|
||||
|
||||
/** @brief Get the overflow size
|
||||
*/
|
||||
int getOverFlowSize() const {return fOverflowSize;}
|
||||
int getOverFlowSize() const
|
||||
{
|
||||
return fOverflowSize;
|
||||
}
|
||||
|
||||
/** @brief Parse the buffer data
|
||||
*/
|
||||
int parse(ColumnInfo &columnInfo);
|
||||
int parse(ColumnInfo& columnInfo);
|
||||
|
||||
/** @brief Set the delimiter used to delimit the columns within a row
|
||||
*/
|
||||
void setColDelimiter(const char & delim){fColDelim = delim;}
|
||||
void setColDelimiter(const char& delim)
|
||||
{
|
||||
fColDelim = delim;
|
||||
}
|
||||
|
||||
/** @brief Set mode to treat "NULL" string as NULL value or not.
|
||||
*/
|
||||
void setNullStringMode( bool bMode ) { fNullStringMode = bMode; }
|
||||
void setNullStringMode( bool bMode )
|
||||
{
|
||||
fNullStringMode = bMode;
|
||||
}
|
||||
|
||||
/** @brief Set character optionally used to enclose input column values.
|
||||
*/
|
||||
void setEnclosedByChar( char enChar ) { fEnclosedByChar = enChar; }
|
||||
void setEnclosedByChar( char enChar )
|
||||
{
|
||||
fEnclosedByChar = enChar;
|
||||
}
|
||||
|
||||
/** @brief Set escape char to use in conjunction with enclosed by char.
|
||||
*/
|
||||
void setEscapeChar ( char esChar ) { fEscapeChar = esChar; }
|
||||
void setEscapeChar ( char esChar )
|
||||
{
|
||||
fEscapeChar = esChar;
|
||||
}
|
||||
|
||||
/** @brief Get the column status
|
||||
* TableInfo::fSyncUpdatesTI mutex should be locked when calling this
|
||||
* TableInfo::fSyncUpdatesTI mutex should be locked when calling this
|
||||
* function (see fColumnLocks discussion).
|
||||
*/
|
||||
Status getColumnStatus(const int & columnId) const
|
||||
{ return fColumnLocks[columnId].status; }
|
||||
Status getColumnStatus(const int& columnId) const
|
||||
{
|
||||
return fColumnLocks[columnId].status;
|
||||
}
|
||||
|
||||
/** @brief Set the column status
|
||||
* TableInfo::fSyncUpdatesTI mutex should be locked when calling this
|
||||
* TableInfo::fSyncUpdatesTI mutex should be locked when calling this
|
||||
* function (see fColumnLocks discussion).
|
||||
* @returns TRUE if all columns in the buffer are complete.
|
||||
*/
|
||||
bool setColumnStatus(const int &columnId, const Status & status);
|
||||
bool setColumnStatus(const int& columnId, const Status& status);
|
||||
|
||||
/** @brief Get the error row status's
|
||||
*/
|
||||
const std::vector< std::pair<RID,std::string> >& getErrorRows() const
|
||||
{return fRowStatus;}
|
||||
const std::vector< std::pair<RID, std::string> >& getErrorRows() const
|
||||
{
|
||||
return fRowStatus;
|
||||
}
|
||||
|
||||
/** @brief Get the error rows
|
||||
*/
|
||||
const std::vector<std::string>& getExactErrorRows() const
|
||||
{return fErrRows;}
|
||||
|
||||
void clearErrRows() {fRowStatus.clear();fErrRows.clear();}
|
||||
{
|
||||
return fErrRows;
|
||||
}
|
||||
|
||||
void clearErrRows()
|
||||
{
|
||||
fRowStatus.clear();
|
||||
fErrRows.clear();
|
||||
}
|
||||
|
||||
/** @brief Get the column locker.
|
||||
* TableInfo::fSyncUpdatesTI mutex should be locked when calling this
|
||||
* TableInfo::fSyncUpdatesTI mutex should be locked when calling this
|
||||
* function (see fColumnLocks discussion).
|
||||
*/
|
||||
const int getColumnLocker(const int & columnId) const
|
||||
{ return fColumnLocks[columnId].locker; }
|
||||
const int getColumnLocker(const int& columnId) const
|
||||
{
|
||||
return fColumnLocks[columnId].locker;
|
||||
}
|
||||
|
||||
/** @brief set truncation as error for this import.
|
||||
*/
|
||||
void setTruncationAsError(bool bTruncationAsError)
|
||||
{ fbTruncationAsError = bTruncationAsError; }
|
||||
void setTruncationAsError(bool bTruncationAsError)
|
||||
{
|
||||
fbTruncationAsError = bTruncationAsError;
|
||||
}
|
||||
|
||||
/** @brief retrieve the tuncation as error setting for this
|
||||
* import. When set, this causes char and varchar strings
|
||||
@ -333,15 +368,19 @@ public:
|
||||
* as errors instead of warnings.
|
||||
*/
|
||||
bool getTruncationAsError() const
|
||||
{ return fbTruncationAsError; }
|
||||
{
|
||||
return fbTruncationAsError;
|
||||
}
|
||||
|
||||
/** @brief Set text vs binary import mode along with corresponding fixed
|
||||
* record length that is used if the binary mode is set to TRUE.
|
||||
*/
|
||||
void setImportDataMode( ImportDataMode importMode,
|
||||
unsigned int fixedBinaryRecLen )
|
||||
{ fImportDataMode = importMode;
|
||||
fFixedBinaryRecLen = fixedBinaryRecLen; }
|
||||
unsigned int fixedBinaryRecLen )
|
||||
{
|
||||
fImportDataMode = importMode;
|
||||
fFixedBinaryRecLen = fixedBinaryRecLen;
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user