You've already forked mariadb-columnstore-engine
mirror of
https://github.com/mariadb-corporation/mariadb-columnstore-engine.git
synced 2025-08-01 06:46:55 +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.
|
||||
//@Bug 6122 if all columns have not null constraint, there is no information in the header
|
||||
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
|
||||
{
|
||||
uint8_t numLoop = 7;
|
||||
@ -722,16 +728,10 @@ int ha_calpont_impl_write_batch_row_(uchar *buf, TABLE* table, cal_impl_if::cal_
|
||||
setError(current_thd, ER_INTERNAL_ERROR, errormsg);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
//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.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;
|
||||
nullBits = nullBits>>1;
|
||||
++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);
|
||||
ci->columnTypes.push_back(ctype);
|
||||
// if ((( ctype.colDataType == CalpontSystemCatalog::VARCHAR ) || ( ctype.colDataType == CalpontSystemCatalog::VARBINARY )) && !ci->useXbit )
|
||||
// ci->useXbit = true;
|
||||
if ((( ctype.colDataType == CalpontSystemCatalog::VARCHAR ) || ( ctype.colDataType == CalpontSystemCatalog::VARBINARY )) && !ci->useXbit )
|
||||
ci->useXbit = true;
|
||||
if (ctype.constraintType == CalpontSystemCatalog::NOTNULL_CONSTRAINT)
|
||||
numberNotNull++;
|
||||
}
|
||||
|
Reference in New Issue
Block a user