You've already forked mariadb-columnstore-engine
mirror of
https://github.com/mariadb-corporation/mariadb-columnstore-engine.git
synced 2025-08-01 06:46:55 +03:00
MCOL-271 empty strings should not be NULLs (#2794)
This patch improves handling of NULLs in textual fields in ColumnStore. Previously empty strings were considered NULLs and it could be a problem if data scheme allows for empty strings. It was also one of major reasons of behavior difference between ColumnStore and other engines in MariaDB family. Also, this patch fixes some other bugs and incorrect behavior, for example, incorrect comparison for "column <= ''" which evaluates to constant True for all purposes before this patch.
This commit is contained in:
committed by
Roman Nozdrin
parent
0ea592da80
commit
b53c231ca6
@ -2330,11 +2330,21 @@ int64_t DataConvert::dateToInt(const string& date)
|
||||
return stringToDate(date);
|
||||
}
|
||||
|
||||
int64_t DataConvert::dateToInt(const utils::NullString& date)
|
||||
{
|
||||
return stringToDate(date);
|
||||
}
|
||||
|
||||
int64_t DataConvert::datetimeToInt(const string& datetime)
|
||||
{
|
||||
return stringToDatetime(datetime);
|
||||
}
|
||||
|
||||
int64_t DataConvert::datetimeToInt(const utils::NullString& datetime)
|
||||
{
|
||||
return stringToDatetime(datetime);
|
||||
}
|
||||
|
||||
int64_t DataConvert::timestampToInt(const string& timestamp, long timeZone)
|
||||
{
|
||||
return stringToTimestamp(timestamp, timeZone);
|
||||
@ -2357,6 +2367,15 @@ int64_t DataConvert::stringToDate(const string& data)
|
||||
else
|
||||
return -1;
|
||||
}
|
||||
int64_t DataConvert::stringToDate(const utils::NullString& data)
|
||||
{
|
||||
if (data.isNull())
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
return stringToDate(data.unsafeStringRef());
|
||||
}
|
||||
|
||||
int64_t DataConvert::stringToDatetime(const string& data, bool* date)
|
||||
{
|
||||
@ -2368,6 +2387,20 @@ int64_t DataConvert::stringToDatetime(const string& data, bool* date)
|
||||
return -1;
|
||||
}
|
||||
|
||||
int64_t DataConvert::stringToDatetime(const utils::NullString& data, bool* date)
|
||||
{
|
||||
if (data.isNull())
|
||||
{
|
||||
if (date)
|
||||
{
|
||||
*date = false;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
return stringToDatetime(data.unsafeStringRef(), date);
|
||||
}
|
||||
|
||||
int64_t DataConvert::stringToTimestamp(const string& data, long timeZone)
|
||||
{
|
||||
TimeStamp aTimestamp;
|
||||
@ -2378,6 +2411,15 @@ int64_t DataConvert::stringToTimestamp(const string& data, long timeZone)
|
||||
return -1;
|
||||
}
|
||||
|
||||
int64_t DataConvert::stringToTimestamp(const utils::NullString& data, long timeZone)
|
||||
{
|
||||
if (data.isNull())
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
return stringToTimestamp(data.unsafeStringRef(), timeZone);
|
||||
}
|
||||
|
||||
/* This is really painful and expensive b/c it seems the input is not normalized or
|
||||
sanitized. That should really be done on ingestion. */
|
||||
int64_t DataConvert::intToDate(int64_t data)
|
||||
@ -2770,6 +2812,11 @@ int64_t DataConvert::intToTime(int64_t data, bool fromString)
|
||||
return getSInt64LE((const char*)&atime);
|
||||
}
|
||||
|
||||
int64_t DataConvert::stringToTime(const utils::NullString& data)
|
||||
{
|
||||
return stringToTime(data.safeString(""));
|
||||
}
|
||||
|
||||
int64_t DataConvert::stringToTime(const string& data)
|
||||
{
|
||||
// MySQL supported time value format 'D HHH:MM:SS.fraction'
|
||||
|
Reference in New Issue
Block a user