You've already forked mariadb-columnstore-engine
mirror of
https://github.com/mariadb-corporation/mariadb-columnstore-engine.git
synced 2025-08-08 14:22:09 +03:00
MCOL-173 Fix null handling for bulk inserts
When infinidb_use_import_for_batchinsert is enabled the NULL handling for the batch insert was incorrect. This is due to an off-by-one on the NULL bitmap. This also affects INSERT...SELECT.
This commit is contained in:
@@ -704,6 +704,12 @@ int ha_calpont_impl_write_batch_row_(uchar *buf, TABLE* table, cal_impl_if::cal_
|
|||||||
buf = buf + ci.headerLength; // Number of bytes used for null bits.
|
buf = buf + ci.headerLength; // Number of bytes used for null bits.
|
||||||
//@Bug 6122 if all columns have not null constraint, there is no information in the header
|
//@Bug 6122 if all columns have not null constraint, there is no information in the header
|
||||||
char nullBits = *bufHdr++;
|
char nullBits = *bufHdr++;
|
||||||
|
if (!ci.useXbit)
|
||||||
|
{
|
||||||
|
// Skip the first bit. For some reason, mysql reserves the first bit of the first byte, unless there's a varchar column in the table.
|
||||||
|
nullBits = nullBits>>1;
|
||||||
|
++headerBit;
|
||||||
|
}
|
||||||
while (colpos < ci.columnTypes.size()) //test bitmap for null values
|
while (colpos < ci.columnTypes.size()) //test bitmap for null values
|
||||||
{
|
{
|
||||||
uint8_t numLoop = 7;
|
uint8_t numLoop = 7;
|
||||||
@@ -726,12 +732,6 @@ int ha_calpont_impl_write_batch_row_(uchar *buf, TABLE* table, cal_impl_if::cal_
|
|||||||
//if a column has not null constraint, it will not be in the bit map
|
//if a column has not null constraint, it will not be in the bit map
|
||||||
if (ci.columnTypes[colpos].constraintType != CalpontSystemCatalog::NOTNULL_CONSTRAINT)
|
if (ci.columnTypes[colpos].constraintType != CalpontSystemCatalog::NOTNULL_CONSTRAINT)
|
||||||
{
|
{
|
||||||
if (!ci.useXbit && (colpos == 0))
|
|
||||||
{
|
|
||||||
// Skip the first bit. For some reason, mysql reserves the first bit of the first byte, unless there's a varchar column in the table.
|
|
||||||
nullBits = nullBits>>1;
|
|
||||||
++headerBit;
|
|
||||||
}
|
|
||||||
nullVal = nullBits & 0x01;
|
nullVal = nullBits & 0x01;
|
||||||
nullBits = nullBits>>1;
|
nullBits = nullBits>>1;
|
||||||
++headerBit;
|
++headerBit;
|
||||||
|
@@ -3397,8 +3397,8 @@ void ha_calpont_impl_start_bulk_insert(ha_rows rows, TABLE* table)
|
|||||||
{
|
{
|
||||||
CalpontSystemCatalog::ColType ctype = csc->colType(colrids[j].objnum);
|
CalpontSystemCatalog::ColType ctype = csc->colType(colrids[j].objnum);
|
||||||
ci->columnTypes.push_back(ctype);
|
ci->columnTypes.push_back(ctype);
|
||||||
// if ((( ctype.colDataType == CalpontSystemCatalog::VARCHAR ) || ( ctype.colDataType == CalpontSystemCatalog::VARBINARY )) && !ci->useXbit )
|
if ((( ctype.colDataType == CalpontSystemCatalog::VARCHAR ) || ( ctype.colDataType == CalpontSystemCatalog::VARBINARY )) && !ci->useXbit )
|
||||||
// ci->useXbit = true;
|
ci->useXbit = true;
|
||||||
if (ctype.constraintType == CalpontSystemCatalog::NOTNULL_CONSTRAINT)
|
if (ctype.constraintType == CalpontSystemCatalog::NOTNULL_CONSTRAINT)
|
||||||
numberNotNull++;
|
numberNotNull++;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user