1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-08-01 06:46:55 +03:00

MCOL-1246 Fix string matching for whitespace

For equality string matches other engines ignore trailing whitespace
(this does not apply to LIKE matches). So we should do the same. This
patch trims whitespace for MIN/MAX extent elimination checks, fixed
width columns and dictionary columns during equality matches against
constants (SELECT * FROM t1 WHERE b = 'ABC').
This commit is contained in:
Andrew Hutchings
2018-03-07 16:56:42 +00:00
parent 55e0ab2386
commit 17e954db7d
4 changed files with 34 additions and 2 deletions

View File

@ -408,6 +408,7 @@ public:
static inline std::string decimalToString(int64_t value, uint8_t scale, execplan::CalpontSystemCatalog::ColDataType colDataType);
static inline void decimalToString(int64_t value, uint8_t scale, char* buf, unsigned int buflen, execplan::CalpontSystemCatalog::ColDataType colDataType);
static inline std::string constructRegexp(const std::string& str);
static inline void trimWhitespace(int64_t &charData);
static inline bool isEscapedChar(char c) { return ('%' == c || '_' == c); }
// convert string to date
@ -552,6 +553,18 @@ inline void DataConvert::decimalToString(int64_t int_val, uint8_t scale, char* b
*(ptr + l1) = '.';
}
inline void DataConvert::trimWhitespace(int64_t &charData)
{
// Trims whitespace characters off non-dict character data
char *ch_data = (char*) &charData;
for (int8_t i = 7; i > 0; i--)
{
if (isspace(ch_data[i]) || ch_data[i] == '\0')
ch_data[i] = '\0';
else
break;
}
}
//FIXME: copy/pasted from dictionary.cpp: refactor
inline std::string DataConvert::constructRegexp(const std::string& str)