You've already forked mariadb-columnstore-engine
mirror of
https://github.com/mariadb-corporation/mariadb-columnstore-engine.git
synced 2025-08-27 16:01:57 +03:00
MCOL-3536 use Locale for compare of strings in ORDER BY
This commit is contained in:
@@ -58,7 +58,6 @@ protected:
|
||||
uint64_t fCount;
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
|
||||
#endif // LIMITED_ORDER_BY_H
|
||||
|
@@ -53,7 +53,7 @@ extern std::locale loc;
|
||||
// Is there a way to construct a global reference to a facet?
|
||||
// const std::collate<char>& coll = std::use_facet<std::collate<char> >(loc);
|
||||
|
||||
//Infinidb version of strlocale BUG 5362
|
||||
//Columnstore version of strlocale BUG 5362
|
||||
//set System Locale "C" by default
|
||||
//return the system Locale currently set in from Columnstore.xml
|
||||
inline
|
||||
|
@@ -375,6 +375,7 @@ public:
|
||||
inline std::string getStringField(uint32_t colIndex) const;
|
||||
inline const uint8_t* getStringPointer(uint32_t colIndex) const;
|
||||
inline uint32_t getStringLength(uint32_t colIndex) const;
|
||||
inline const char* getCharPtrField(uint32_t colIndex, int& len) const;
|
||||
void setStringField(const std::string& val, uint32_t colIndex);
|
||||
inline void setStringField(const uint8_t*, uint32_t len, uint32_t colIndex);
|
||||
|
||||
@@ -774,6 +775,17 @@ inline std::string Row::getStringField(uint32_t colIndex) const
|
||||
strnlen((char*) &data[offsets[colIndex]], getColumnWidth(colIndex)));
|
||||
}
|
||||
|
||||
// Return a char* to the string field with len
|
||||
inline const char* Row::getCharPtrField(uint32_t colIndex, int& len) const
|
||||
{
|
||||
len = getStringLength(colIndex);
|
||||
if (inStringTable(colIndex))
|
||||
{
|
||||
return (const char*)strings->getPointer(*((uint64_t*) &data[offsets[colIndex]]));
|
||||
}
|
||||
return (char*)&data[offsets[colIndex]];
|
||||
}
|
||||
|
||||
inline std::string Row::getVarBinaryStringField(uint32_t colIndex) const
|
||||
{
|
||||
if (inStringTable(colIndex))
|
||||
|
@@ -130,13 +130,11 @@ int StringCompare::operator()(IdbCompare* l, Row::Pointer r1, Row::Pointer r2)
|
||||
}
|
||||
else
|
||||
{
|
||||
string v1 = l->row1().getStringField(fSpec.fIndex);
|
||||
string v2 = l->row2().getStringField(fSpec.fIndex);
|
||||
|
||||
if (v1 > v2)
|
||||
ret = fSpec.fAsc;
|
||||
else if (v1 < v2)
|
||||
ret = -fSpec.fAsc;
|
||||
int len1, len2;
|
||||
const char* s1 = l->row1().getCharPtrField(fSpec.fIndex, len1);
|
||||
const char* s2 = l->row2().getCharPtrField(fSpec.fIndex, len2);
|
||||
const std::collate<char>& coll = std::use_facet<std::collate<char> >(loc);
|
||||
ret = fSpec.fAsc * coll.compare(s1, s1+len1, s2, s2+len2);
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
Reference in New Issue
Block a user