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

MCOL-5480 LOAD DATA INFILE incorrectly loads values for MEDIUMINT datatype.

Internal memory representation of MEDIUMINT datatype uses 24 bits. This is
true for both MariaDB server as well as ColumnStore. MCS plugin code uses
TypeHandlerSInt24 and TypeHandlerUInt24 classes to respectively convert the
binary representation of the signed and unsigned MEDIUMINT values passed by
the server to the plugin. The plugin then outputs the text representation
of these values into an open file descriptor which is piped to cpimport
for the final load into the MCS db files.

The TypeHandlerXInt24 classes were earlier incorrectly using
WriteBatchField::ColWriteBatchXInt32() functions which operate on a 4 byte
buffer. This resulted in incorrect parsing of MEDIUMINT values. As a fix,
we implement WriteBatchField::ColWriteBatchXInt24() functions which
correctly handle the 24 bit input buffer used for MEDIUMINT datatype.
This commit is contained in:
Gagan Goel
2023-05-19 18:30:52 -04:00
parent 611087fe7c
commit 10f1a7abbc
4 changed files with 316 additions and 2 deletions

View File

@ -1015,6 +1015,8 @@ class WriteBatchField
virtual size_t ColWriteBatchUInt64(const unsigned char* buf, bool nullVal, ColBatchWriter& ci) = 0;
virtual size_t ColWriteBatchSInt32(const unsigned char* buf, bool nullVal, ColBatchWriter& ci) = 0;
virtual size_t ColWriteBatchUInt32(const unsigned char* buf, bool nullVal, ColBatchWriter& ci) = 0;
virtual size_t ColWriteBatchSInt24(const unsigned char* buf, bool nullVal, ColBatchWriter& ci) = 0;
virtual size_t ColWriteBatchUInt24(const unsigned char* buf, bool nullVal, ColBatchWriter& ci) = 0;
virtual size_t ColWriteBatchSInt16(const unsigned char* buf, bool nullVal, ColBatchWriter& ci) = 0;
virtual size_t ColWriteBatchUInt16(const unsigned char* buf, bool nullVal, ColBatchWriter& ci) = 0;
virtual size_t ColWriteBatchSInt8(const unsigned char* buf, bool nullVal, ColBatchWriter& ci) = 0;
@ -1294,7 +1296,7 @@ class TypeHandlerSInt24 : public TypeHandlerInt
size_t ColWriteBatch(WriteBatchField* field, const unsigned char* buf, bool nullVal,
ColBatchWriter& writer) const override
{
return field->ColWriteBatchSInt32(buf, nullVal, writer);
return field->ColWriteBatchSInt24(buf, nullVal, writer);
}
int storeValueToField(rowgroup::Row& row, int pos, StoreField* f) const override
{
@ -1567,7 +1569,7 @@ class TypeHandlerUInt24 : public TypeHandlerInt
size_t ColWriteBatch(WriteBatchField* field, const unsigned char* buf, bool nullVal,
ColBatchWriter& writer) const override
{
return field->ColWriteBatchUInt32(buf, nullVal, writer);
return field->ColWriteBatchUInt24(buf, nullVal, writer);
}
int storeValueToField(rowgroup::Row& row, int pos, StoreField* f) const override
{