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

MCOL-1968 Fix UTF char/varchar min/max handling

If the first byte of a char/varchar was > 0x80 then it will break the
min/max values for an extent during cpimport. This patch makes the
min/max compare unsigned and only switches to signed when storing.

In addition send all the LDI / INSERT...SELECT data to cpimport, not
truncated. Let cpimport figure out the truncation point.
This commit is contained in:
Andrew Hutchings
2019-06-11 10:37:04 +01:00
parent 4628346746
commit e3cd205388
2 changed files with 17 additions and 12 deletions

View File

@ -524,13 +524,16 @@ void BulkLoadBuffer::convert(char *field, int fieldLength,
}
// Swap byte order before comparing character string
int64_t binChar = static_cast<int64_t>( uint64ToStr(
*(reinterpret_cast<uint64_t*>(charTmpBuf)) ) );
// Compare must be unsigned
uint64_t compChar = uint64ToStr( *(reinterpret_cast<uint64_t*>(charTmpBuf)) );
int64_t binChar = static_cast<int64_t>( compChar );
// Update min/max range
if (binChar < bufStats.minBufferVal)
uint64_t minVal = static_cast<uint64_t>( bufStats.minBufferVal );
uint64_t maxVal = static_cast<uint64_t>( bufStats.maxBufferVal );
if (compChar < minVal)
bufStats.minBufferVal = binChar;
if (binChar > bufStats.maxBufferVal)
if (compChar > maxVal)
bufStats.maxBufferVal = binChar;
pVal = charTmpBuf;