You've already forked mariadb-columnstore-engine
mirror of
https://github.com/mariadb-corporation/mariadb-columnstore-engine.git
synced 2025-07-30 19:23:07 +03:00
MCOL-4721 CHAR(1) is not collation-aware for GROUP/DISTINCT
This commit is contained in:
@ -1130,54 +1130,6 @@ bool Row::equals(const std::string& val, uint32_t col) const
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Row::equals(const Row& r2, const std::vector<uint32_t>& keyCols) const
|
||||
{
|
||||
for (uint32_t i = 0; i < keyCols.size(); i++)
|
||||
{
|
||||
const uint32_t& col = keyCols[i];
|
||||
cscDataType columnType = getColType(col);
|
||||
|
||||
if (UNLIKELY(columnType == execplan::CalpontSystemCatalog::VARCHAR ||
|
||||
(columnType == execplan::CalpontSystemCatalog::CHAR && (colWidths[col] > 1)) ||
|
||||
columnType == execplan::CalpontSystemCatalog::TEXT))
|
||||
{
|
||||
CHARSET_INFO* cs = getCharset(col);
|
||||
if (cs->strnncollsp(getStringPointer(col), getStringLength(col),
|
||||
r2.getStringPointer(col), r2.getStringLength(col)))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else if (UNLIKELY(columnType == execplan::CalpontSystemCatalog::BLOB))
|
||||
{
|
||||
if (getStringLength(col) != r2.getStringLength(col))
|
||||
return false;
|
||||
|
||||
if (memcmp(getStringPointer(col), r2.getStringPointer(col), getStringLength(col)))
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (UNLIKELY(columnType == execplan::CalpontSystemCatalog::LONGDOUBLE))
|
||||
{
|
||||
if (getLongDoubleField(col) != r2.getLongDoubleField(col))
|
||||
return false;
|
||||
}
|
||||
else if (UNLIKELY(datatypes::isWideDecimalType(columnType, colWidths[col])))
|
||||
{
|
||||
if (*getBinaryField<int128_t>(col) != *r2.getBinaryField<int128_t>(col))
|
||||
return false;
|
||||
}
|
||||
else if (getUintField(col) != r2.getUintField(col))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Row::equals(const Row& r2, uint32_t lastCol) const
|
||||
{
|
||||
// This check fires with empty r2 only.
|
||||
@ -1196,9 +1148,7 @@ bool Row::equals(const Row& r2, uint32_t lastCol) const
|
||||
for (uint32_t col = 0; col <= lastCol; col++)
|
||||
{
|
||||
cscDataType columnType = getColType(col);
|
||||
if (UNLIKELY(columnType == execplan::CalpontSystemCatalog::VARCHAR ||
|
||||
(columnType == execplan::CalpontSystemCatalog::CHAR && (colWidths[col] > 1)) ||
|
||||
columnType == execplan::CalpontSystemCatalog::TEXT))
|
||||
if (UNLIKELY(typeHasCollation(columnType)))
|
||||
{
|
||||
CHARSET_INFO* cs = getCharset(col);
|
||||
if (cs->strnncollsp(getStringPointer(col), getStringLength(col),
|
||||
@ -1304,10 +1254,7 @@ RowGroup::RowGroup(uint32_t colCount,
|
||||
else
|
||||
stOffsets[i + 1] = stOffsets[i] + colWidths[i];
|
||||
|
||||
execplan::CalpontSystemCatalog::ColDataType type = types[i];
|
||||
if ((type == execplan::CalpontSystemCatalog::CHAR && (colWidths[i] > 1)) ||
|
||||
type == execplan::CalpontSystemCatalog::VARCHAR ||
|
||||
type == execplan::CalpontSystemCatalog::TEXT)
|
||||
if (colHasCollation(i))
|
||||
{
|
||||
hasCollation = true;
|
||||
}
|
||||
@ -1916,10 +1863,7 @@ RowGroup RowGroup::truncate(uint32_t cols)
|
||||
ret.hasLongStringField = true;
|
||||
}
|
||||
|
||||
execplan::CalpontSystemCatalog::ColDataType type = types[i];
|
||||
if ((type == execplan::CalpontSystemCatalog::CHAR && (colWidths[i] > 1)) ||
|
||||
type == execplan::CalpontSystemCatalog::VARCHAR ||
|
||||
type == execplan::CalpontSystemCatalog::TEXT)
|
||||
if (colHasCollation(i))
|
||||
{
|
||||
ret.hasCollation = true;
|
||||
}
|
||||
|
@ -372,6 +372,11 @@ public:
|
||||
inline bool isShortString(uint32_t colIndex) const;
|
||||
inline bool isLongString(uint32_t colIndex) const;
|
||||
|
||||
bool colHasCollation(uint32_t colIndex) const
|
||||
{
|
||||
return datatypes::typeHasCollation(getColType(colIndex));
|
||||
}
|
||||
|
||||
template<int len> inline uint64_t getUintField(uint32_t colIndex) const;
|
||||
inline uint64_t getUintField(uint32_t colIndex) const;
|
||||
template<int len> inline int64_t getIntField(uint32_t colIndex) const;
|
||||
@ -555,7 +560,6 @@ public:
|
||||
inline uint64_t hash() const; // generates a hash for all cols
|
||||
inline void colUpdateMariaDBHasher(datatypes::MariaDBHasher &hasher, uint32_t col) const;
|
||||
|
||||
bool equals(const Row&, const std::vector<uint32_t>& keyColumns) const;
|
||||
bool equals(const Row&, uint32_t lastCol) const;
|
||||
inline bool equals(const Row&) const;
|
||||
|
||||
@ -1508,6 +1512,11 @@ public:
|
||||
inline bool isShortString(uint32_t colIndex) const;
|
||||
inline bool isLongString(uint32_t colIndex) const;
|
||||
|
||||
bool colHasCollation(uint32_t colIndex) const
|
||||
{
|
||||
return datatypes::typeHasCollation(getColType(colIndex));
|
||||
}
|
||||
|
||||
inline const std::vector<uint32_t>& getScale() const;
|
||||
inline const std::vector<uint32_t>& getPrecision() const;
|
||||
|
||||
|
Reference in New Issue
Block a user