1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-08-07 03:22:57 +03:00

MCOL-3536 collation

This commit is contained in:
David Hall
2020-06-08 16:09:46 -05:00
parent 236b92d706
commit 938ee6d308
3 changed files with 23 additions and 22 deletions

View File

@@ -103,21 +103,21 @@ string Func_concat_ws::getStrVal(Row& row,
#endif #endif
string str; string str;
string tmp; string tmp;
// Work on reallocation. use std::string::resize() to
// grab larger chunks in some intellegent manner.
for ( uint32_t i = 1 ; i < parm.size() ; i++) for ( uint32_t i = 1 ; i < parm.size() ; i++)
{ {
stringValue(parm[i], row, isNull, tmp); stringValue(parm[i], row, isNull, tmp);
str += tmp;
if (isNull) if (isNull)
{ {
isNull = false; isNull = false;
continue; continue;
} }
if (!str.empty() && !isNull) if (!str.empty())
str += delim; str += delim;
// TODO: Work on string reallocation. Use std::string::resize() to
// grab larger chunks in some intellegent manner.
str += tmp;
} }
if (str.empty()) if (str.empty())

View File

@@ -69,7 +69,7 @@ int64_t Func_find_in_set::getIntVal(rowgroup::Row& row,
if (searchStr.find(",") != string::npos) if (searchStr.find(",") != string::npos)
return 0; return 0;
if (setString.length() > searchStr.length()) if (setString.length() < searchStr.length())
return 0; return 0;
CHARSET_INFO *cs= op_ct.getCharset(); CHARSET_INFO *cs= op_ct.getCharset();
@@ -79,7 +79,7 @@ int64_t Func_find_in_set::getIntVal(rowgroup::Row& row,
const char *str_end = setString.c_str(); const char *str_end = setString.c_str();
const char *real_end = str_end + setString.length(); const char *real_end = str_end + setString.length();
const char *find_str = searchStr.c_str(); const char *find_str = searchStr.c_str();
uint find_str_len= searchStr.length(); size_t find_str_len = searchStr.length();
int position = 0; int position = 0;
static const char separator=','; static const char separator=',';
while (1) while (1)
@@ -96,9 +96,9 @@ int64_t Func_find_in_set::getIntVal(rowgroup::Row& row,
position++; position++;
if (is_last_item && !is_separator) if (is_last_item && !is_separator)
str_end = substr_end; str_end = substr_end;
if (!cs->strnncoll(str_begin, (uint) (str_end - str_begin), if (!cs->strnncoll(str_begin, (size_t) (str_end - str_begin),
find_str, find_str_len)) find_str, find_str_len))
return (longlong) position; return (int64_t) position;
else else
str_begin = substr_end; str_begin = substr_end;
} }

View File

@@ -88,7 +88,7 @@ std::string Func_insert::getStrVal(rowgroup::Row& row,
int64_t strLen = cs->numchars(pos, end); int64_t strLen = cs->numchars(pos, end);
// Return the original string if start isn't within the string. // Return the original string if start isn't within the string.
if ((start <= 1) || start >= strLen) if ((start < 1) || start >= strLen)
return src; return src;
if ((length < 0) || (length > strLen)) if ((length < 0) || (length > strLen))
@@ -103,6 +103,7 @@ std::string Func_insert::getStrVal(rowgroup::Row& row,
out.append(src.c_str(), start); out.append(src.c_str(), start);
out.append(tnewstr.c_str(), tnewstr.length()); out.append(tnewstr.c_str(), tnewstr.length());
if (binLen - start - length > 0)
out.append(src.c_str() + start + length, binLen - start - length); out.append(src.c_str() + start + length, binLen - start - length);
return out; return out;