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
Add support for zero date separate to NULL
NULL is now pushed through the MariaDB storage engine plugin down to the insert processing. A '0000-00-00' date is now a separate value to NULL. This is more in-line with MariaDB's handling.
This commit is contained in:
@ -174,7 +174,7 @@ dmlpackage::CalpontDMLPackage* CalpontDMLFactory::makeCalpontDMLPackageFromMysql
|
||||
{
|
||||
case DML_INSERT:
|
||||
packagePtr = new InsertDMLPackage(vpackage.get_SchemaName(), vpackage.get_TableName(), vpackage.get_DMLStatement(), vpackage.get_SessionID());
|
||||
(void)packagePtr->buildFromMysqlBuffer(vpackage.get_ColNames(), vpackage.get_values(), vpackage.get_Columns(), vpackage.get_Rows());
|
||||
(void)packagePtr->buildFromMysqlBuffer(vpackage.get_ColNames(), vpackage.get_values(), vpackage.get_Columns(), vpackage.get_Rows(), vpackage.get_nullValues());
|
||||
break;
|
||||
case DML_COMMAND:
|
||||
packagePtr = new CommandDMLPackage(vpackage.get_DMLStatement(), vpackage.get_SessionID() );
|
||||
@ -182,7 +182,7 @@ dmlpackage::CalpontDMLPackage* CalpontDMLFactory::makeCalpontDMLPackageFromMysql
|
||||
case DML_DELETE:
|
||||
packagePtr = new DeleteDMLPackage(vpackage.get_SchemaName(), vpackage.get_TableName(),
|
||||
vpackage.get_DMLStatement(), vpackage.get_SessionID() );
|
||||
(void)packagePtr->buildFromMysqlBuffer(vpackage.get_ColNames(), vpackage.get_values(), vpackage.get_Columns(), vpackage.get_Rows());
|
||||
(void)packagePtr->buildFromMysqlBuffer(vpackage.get_ColNames(), vpackage.get_values(), vpackage.get_Columns(), vpackage.get_Rows(), vpackage.get_nullValues());
|
||||
break;
|
||||
default:
|
||||
cerr << "makeCalpontDMLPackage: invalid statement type" << endl;
|
||||
|
@ -94,7 +94,7 @@ namespace dmlpackage
|
||||
* @param columns number of columns in the table
|
||||
* @param rows number of rows to be touched
|
||||
*/
|
||||
virtual int buildFromMysqlBuffer(ColNameList& colNameList, TableValuesMap& tableValuesMap, int columns, int rows) = 0;
|
||||
virtual int buildFromMysqlBuffer(ColNameList& colNameList, TableValuesMap& tableValuesMap, int columns, int rows, NullValuesBitset& nullValues) = 0;
|
||||
|
||||
/** @brief get the table object
|
||||
*/
|
||||
|
@ -86,7 +86,7 @@ namespace dmlpackage
|
||||
* @param colNameList, tableValuesMap
|
||||
* @param rows the number of rows in the buffer
|
||||
*/
|
||||
int buildFromMysqlBuffer(ColNameList& colNameList, TableValuesMap& tableValuesMap, int columns, int rows)
|
||||
int buildFromMysqlBuffer(ColNameList& colNameList, TableValuesMap& tableValuesMap, int columns, int rows, NullValuesBitset& nullValues)
|
||||
{
|
||||
return 1;
|
||||
};
|
||||
|
@ -189,7 +189,7 @@ int DeleteDMLPackage::buildFromBuffer(std::string& buffer, int columns, int rows
|
||||
|
||||
}
|
||||
|
||||
int DeleteDMLPackage::buildFromMysqlBuffer(ColNameList& colNameList, TableValuesMap& tableValuesMap, int columns, int rows )
|
||||
int DeleteDMLPackage::buildFromMysqlBuffer(ColNameList& colNameList, TableValuesMap& tableValuesMap, int columns, int rows, NullValuesBitset& nullValues )
|
||||
{
|
||||
int retval = 1;
|
||||
|
||||
|
@ -92,7 +92,7 @@ namespace dmlpackage
|
||||
* @param colNameList, tableValuesMap
|
||||
* @param rows the number of rows in the buffer
|
||||
*/
|
||||
EXPORT int buildFromMysqlBuffer(ColNameList& colNameList, TableValuesMap& tableValuesMap, int columns, int rows);
|
||||
EXPORT int buildFromMysqlBuffer(ColNameList& colNameList, TableValuesMap& tableValuesMap, int columns, int rows, NullValuesBitset& nullValues);
|
||||
|
||||
protected:
|
||||
|
||||
|
@ -29,6 +29,7 @@
|
||||
#include <map>
|
||||
#include <utility>
|
||||
#include <iostream>
|
||||
#include <bitset>
|
||||
#include <stdint.h>
|
||||
|
||||
namespace dmlpackage
|
||||
@ -71,6 +72,7 @@ typedef std::vector<char*> QueryBuffer;
|
||||
typedef std::vector<std::string> ColValuesList;
|
||||
typedef std::vector<std::string> ColNameList;
|
||||
typedef std::map<uint32_t, ColValuesList> TableValuesMap;
|
||||
typedef std::bitset<4096> NullValuesBitset;
|
||||
|
||||
std::ostream& operator<<(std::ostream& os, const SqlStatementList& ct);
|
||||
std::ostream& operator<<(std::ostream& os, const SqlStatement& stmt);
|
||||
|
@ -151,7 +151,7 @@ int InsertDMLPackage::buildFromBuffer(std::string& buffer, int columns, int rows
|
||||
return retval;
|
||||
}
|
||||
|
||||
int InsertDMLPackage::buildFromMysqlBuffer(ColNameList& colNameList, TableValuesMap& tableValuesMap, int columns, int rows )
|
||||
int InsertDMLPackage::buildFromMysqlBuffer(ColNameList& colNameList, TableValuesMap& tableValuesMap, int columns, int rows, NullValuesBitset& nullValues )
|
||||
{
|
||||
int retval = 1;
|
||||
|
||||
@ -166,7 +166,7 @@ int InsertDMLPackage::buildFromMysqlBuffer(ColNameList& colNameList, TableValues
|
||||
|
||||
colValList = tableValuesMap[j];
|
||||
|
||||
DMLColumn* aColumn = new DMLColumn(colName, colValList, false);
|
||||
DMLColumn* aColumn = new DMLColumn(colName, colValList, false, 0, nullValues[j]);
|
||||
(aRowPtr->get_ColumnList()).push_back(aColumn);
|
||||
}
|
||||
//build a row list for a table
|
||||
|
@ -88,7 +88,7 @@ public:
|
||||
* @param columns number of columns in the table
|
||||
* @param rows number of rows to be touched
|
||||
*/
|
||||
EXPORT int buildFromMysqlBuffer(ColNameList& colNameList, TableValuesMap& tableValuesMap, int columns, int rows);
|
||||
EXPORT int buildFromMysqlBuffer(ColNameList& colNameList, TableValuesMap& tableValuesMap, int columns, int rows, NullValuesBitset& nullValues);
|
||||
|
||||
/** @brief build a InsertDMLPackage from a InsertSqlStatement
|
||||
*
|
||||
|
@ -206,7 +206,7 @@ int UpdateDMLPackage::buildFromBuffer(std::string& buffer, int columns, int rows
|
||||
|
||||
return retval;
|
||||
}
|
||||
int UpdateDMLPackage::buildFromMysqlBuffer(ColNameList& colNameList, TableValuesMap& tableValuesMap, int columns, int rows )
|
||||
int UpdateDMLPackage::buildFromMysqlBuffer(ColNameList& colNameList, TableValuesMap& tableValuesMap, int columns, int rows, NullValuesBitset& nullValues )
|
||||
{
|
||||
int retval = 1;
|
||||
|
||||
@ -221,7 +221,7 @@ int UpdateDMLPackage::buildFromMysqlBuffer(ColNameList& colNameList, TableValues
|
||||
|
||||
colValList = tableValuesMap[j];
|
||||
|
||||
DMLColumn* aColumn = new DMLColumn(colName, colValList, false);
|
||||
DMLColumn* aColumn = new DMLColumn(colName, colValList, false, 0, nullValues[j]);
|
||||
(aRowPtr->get_ColumnList()).push_back(aColumn);
|
||||
}
|
||||
//build a row list for a table
|
||||
|
@ -92,7 +92,7 @@ namespace dmlpackage
|
||||
* @param colNameList, tableValuesMap
|
||||
* @param rows the number of rows in the buffer
|
||||
*/
|
||||
EXPORT int buildFromMysqlBuffer(ColNameList& colNameList, TableValuesMap& tableValuesMap, int columns, int rows);
|
||||
EXPORT int buildFromMysqlBuffer(ColNameList& colNameList, TableValuesMap& tableValuesMap, int columns, int rows, NullValuesBitset& nullValues);
|
||||
void buildUpdateFromMysqlBuffer(UpdateSqlStatement& updateStmt );
|
||||
|
||||
|
||||
|
@ -48,10 +48,10 @@ namespace dmlpackage
|
||||
{}
|
||||
|
||||
VendorDMLStatement::VendorDMLStatement(std::string dmlstatement, int stmttype, std::string tName, std::string schema, int rows, int columns,
|
||||
ColNameList& colNameList, TableValuesMap& tableValuesMap, int sessionID)
|
||||
ColNameList& colNameList, TableValuesMap& tableValuesMap, NullValuesBitset& nullValues, int sessionID)
|
||||
:fDMLStatement(dmlstatement), fDMLStatementType(stmttype),
|
||||
fTableName(tName), fSchema(schema), fRows(rows), fColumns(columns),
|
||||
fColNameList(colNameList), fTableValuesMap(tableValuesMap), fSessionID(sessionID), fLogging(true),fLogending(true)
|
||||
fColNameList(colNameList), fTableValuesMap(tableValuesMap), fNullValues(nullValues), fSessionID(sessionID), fLogging(true),fLogending(true)
|
||||
{}
|
||||
|
||||
VendorDMLStatement::~VendorDMLStatement()
|
||||
|
@ -26,6 +26,7 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <map>
|
||||
#include <bitset>
|
||||
#include <stdint.h>
|
||||
|
||||
#if defined(_MSC_VER) && defined(xxxVENDORDMLSTATEMENT_DLLEXPORT)
|
||||
@ -38,6 +39,7 @@ namespace dmlpackage
|
||||
typedef std::vector<std::string> ColValuesList;
|
||||
typedef std::vector<std::string> ColNameList;
|
||||
typedef std::map<uint32_t, ColValuesList> TableValuesMap;
|
||||
typedef std::bitset<4096> NullValuesBitset;
|
||||
|
||||
/** @brief describes the general interface
|
||||
* and implementation of a Vendor DML Statement
|
||||
@ -63,7 +65,7 @@ namespace dmlpackage
|
||||
/** @brief ctor for mysql
|
||||
*/
|
||||
EXPORT VendorDMLStatement(std::string dmlstatement, int stmttype, std::string tName, std::string schema, int rows, int columns,
|
||||
ColNameList& colNameList, TableValuesMap& tableValuesMap, int sessionID);
|
||||
ColNameList& colNameList, TableValuesMap& tableValuesMap, NullValuesBitset& nullValues, int sessionID);
|
||||
|
||||
/** @brief destructor
|
||||
*/
|
||||
@ -128,6 +130,8 @@ namespace dmlpackage
|
||||
*/
|
||||
inline int get_SessionID() { return fSessionID; }
|
||||
|
||||
inline NullValuesBitset& get_nullValues() { return fNullValues; }
|
||||
|
||||
/** @brief Set the session ID
|
||||
*/
|
||||
inline void set_SessionID( int value ) { fSessionID = value; }
|
||||
@ -172,6 +176,7 @@ namespace dmlpackage
|
||||
std::string fDataBuffer;
|
||||
ColNameList fColNameList;
|
||||
TableValuesMap fTableValuesMap;
|
||||
NullValuesBitset fNullValues;
|
||||
int fSessionID;
|
||||
bool fLogging;
|
||||
bool fLogending;
|
||||
|
Reference in New Issue
Block a user