You've already forked mariadb-columnstore-engine
mirror of
https://github.com/mariadb-corporation/mariadb-columnstore-engine.git
synced 2025-07-27 21:01:50 +03:00
Fix MCOL-5035, a difference in INSERT and UPDATE behavior
The UPDATE statement wrote NULL when the column set is DATETIME and value is '0000-00-00 00:00:00'. The problem was inside WriteEngine's handling of UPDATE statements and this is where heart of change is. Other changes are related to some obsolete data structures in DML/DDL handling that just hanging around there, doing nothing.
This commit is contained in:
committed by
Sergey Zefirov
parent
2c44af30c7
commit
2cd8f716c1
@ -196,42 +196,6 @@ class DDLPackageProcessor
|
||||
int spare : 6;
|
||||
Date( ) { year = 0; month = 0; day = 0; spare = 0;}
|
||||
}; */
|
||||
/** @brief a structure to hold a datetime
|
||||
*/
|
||||
struct dateTime
|
||||
{
|
||||
unsigned msecond : 20;
|
||||
unsigned second : 6;
|
||||
unsigned minute : 6;
|
||||
unsigned hour : 6;
|
||||
unsigned day : 6;
|
||||
unsigned month : 4;
|
||||
unsigned year : 16;
|
||||
// NULL column value = 0xFFFFFFFFFFFFFFFE
|
||||
EXPORT dateTime()
|
||||
{
|
||||
year = 0xFFFF;
|
||||
month = 0xF;
|
||||
day = 0x3F;
|
||||
hour = 0x3F;
|
||||
minute = 0x3F;
|
||||
second = 0x3F;
|
||||
msecond = 0xFFFFE;
|
||||
}
|
||||
};
|
||||
/*
|
||||
struct dateTime
|
||||
{
|
||||
int year : 16;
|
||||
int month : 4;
|
||||
int day : 6;
|
||||
int hour : 6;
|
||||
int minute : 6;
|
||||
int second : 6;
|
||||
int msecond : 20;
|
||||
dateTime( ) { year = 0; month = 0; day = 0; hour = 0; minute = 0; second = 0; msecond = 0; }
|
||||
}
|
||||
; */
|
||||
/** @brief a vector of dictionary object ids
|
||||
*/
|
||||
typedef std::vector<DictOID> DictionaryOIDList;
|
||||
|
@ -149,30 +149,6 @@ class DMLPackageProcessor
|
||||
spare = 0x3E;
|
||||
}
|
||||
};
|
||||
/** @brief a structure to hold a datetime
|
||||
*/
|
||||
struct dateTime
|
||||
{
|
||||
unsigned msecond : 20;
|
||||
unsigned second : 6;
|
||||
unsigned minute : 6;
|
||||
unsigned hour : 6;
|
||||
unsigned day : 6;
|
||||
unsigned month : 4;
|
||||
unsigned year : 16;
|
||||
// NULL column value = 0xFFFFFFFFFFFFFFFE
|
||||
dateTime()
|
||||
{
|
||||
year = 0xFFFF;
|
||||
month = 0xF;
|
||||
day = 0x3F;
|
||||
hour = 0x3F;
|
||||
minute = 0x3F;
|
||||
second = 0x3F;
|
||||
msecond = 0xFFFFE;
|
||||
}
|
||||
};
|
||||
|
||||
/** @brief ctor
|
||||
*/
|
||||
DMLPackageProcessor(BRM::DBRM* aDbrm, uint32_t sid)
|
||||
|
@ -0,0 +1,17 @@
|
||||
DROP DATABASE IF EXISTS MCOL5535;
|
||||
CREATE DATABASE MCOL5535;
|
||||
USE MCOL5535;
|
||||
CREATE TABLE t1(i INTEGER, x DATETIME) ENGINE=COLUMNSTORE;
|
||||
INSERT INTO t1 (i, x) VALUES (1, '0000-00-00 00:00:00'), (2, NULL), (3, '2024-01-01 01:01:01');
|
||||
SELECT * FROM t1;
|
||||
i x
|
||||
1 0000-00-00 00:00:00
|
||||
2 NULL
|
||||
3 2024-01-01 01:01:01
|
||||
UPDATE t1 SET x='0000-00-00 00:00:00' WHERE i = 3;
|
||||
SELECT * FROM t1;
|
||||
i x
|
||||
1 0000-00-00 00:00:00
|
||||
2 NULL
|
||||
3 0000-00-00 00:00:00
|
||||
DROP DATABASE MCOL5535;
|
@ -0,0 +1,19 @@
|
||||
--disable_warnings
|
||||
DROP DATABASE IF EXISTS MCOL5535;
|
||||
--enable_warnings
|
||||
|
||||
CREATE DATABASE MCOL5535;
|
||||
|
||||
USE MCOL5535;
|
||||
|
||||
CREATE TABLE t1(i INTEGER, x DATETIME) ENGINE=COLUMNSTORE;
|
||||
|
||||
INSERT INTO t1 (i, x) VALUES (1, '0000-00-00 00:00:00'), (2, NULL), (3, '2024-01-01 01:01:01');
|
||||
|
||||
SELECT * FROM t1;
|
||||
|
||||
UPDATE t1 SET x='0000-00-00 00:00:00' WHERE i = 3;
|
||||
|
||||
SELECT * FROM t1;
|
||||
|
||||
DROP DATABASE MCOL5535;
|
@ -3696,16 +3696,6 @@ uint8_t WE_DMLCommandProc::processUpdate(messageqcpp::ByteStream& bs, std::strin
|
||||
inData = columnsUpdated[j]->get_DataVector()[0];
|
||||
}
|
||||
|
||||
if (((colType.colDataType == execplan::CalpontSystemCatalog::DATE) && (inData.safeString("").compare("0000-00-00") == 0)) ||
|
||||
((colType.colDataType == execplan::CalpontSystemCatalog::DATETIME) &&
|
||||
(inData.safeString("").compare("0000-00-00 00:00:00") == 0)) ||
|
||||
((colType.colDataType == execplan::CalpontSystemCatalog::TIMESTAMP) &&
|
||||
(inData.safeString("").compare("0000-00-00 00:00:00") == 0)))
|
||||
{
|
||||
inData.dropString();
|
||||
isNull = true;
|
||||
}
|
||||
|
||||
uint64_t nextVal = 0;
|
||||
|
||||
if (colType.autoincrement)
|
||||
|
Reference in New Issue
Block a user