1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-06-13 16:01:32 +03:00

MCOL-4779 Keep correct ranges during DML for short char columns

This commit is contained in:
Sergey Zefirov
2021-06-29 17:35:07 +03:00
parent 4069a48f42
commit 6eaee180f3
2 changed files with 49 additions and 13 deletions

View File

@ -331,6 +331,11 @@ void WriteEngineWrapper::updateMaxMinRange(const size_t totalNewRow, const size_
{
return ;
}
if (colType == WR_CHAR)
{
maxMin->toInvalid(); // simple and wrong solution.
return;
}
bool isUnsigned = false; // TODO: should change with type.
switch (colType)
{
@ -338,6 +343,7 @@ void WriteEngineWrapper::updateMaxMinRange(const size_t totalNewRow, const size_
case WR_USHORT:
case WR_UINT:
case WR_ULONGLONG:
case WR_CHAR:
{
isUnsigned = true;
break;
@ -353,6 +359,14 @@ void WriteEngineWrapper::updateMaxMinRange(const size_t totalNewRow, const size_
return ;
}
}
if (colType == WR_CHAR)
{
idbassert(MAX_COLUMN_BOUNDARY == sizeof(uint64_t)); // have to check that - code below depends on that.
if (!maxMin->isInvalid())
{
maxMin->fromToChars();
}
}
size_t i;
for (i = 0; i < totalOldRow; i++) {
int64_t value = 0, oldValue = 0;
@ -409,6 +423,16 @@ void WriteEngineWrapper::updateMaxMinRange(const size_t totalNewRow, const size_
fetchNewOldValues<int128_t, int128_t>(bvalue, oldBValue, valArrayVoid, oldValArrayVoid, i, totalNewRow);
break;
}
case WR_CHAR:
{
fetchNewOldValues<uint64_t, uint64_t>(uvalue, oldUValue, valArrayVoid, oldValArrayVoid, i, totalNewRow);
// for characters (strings, actually), we fetched then in LSB order, on x86, at the very least.
// this means most significant byte of the string, which is first, is now in LSB of uvalue/oldValue.
// we must perform a conversion.
uvalue = uint64ToStr(uvalue);
oldValue = uint64ToStr(oldValue);
break;
}
default:
idbassert_s(0, "unknown WR type tag");
return;
@ -435,6 +459,12 @@ void WriteEngineWrapper::updateMaxMinRange(const size_t totalNewRow, const size_
}
}
}
// the range will be kept.
// to handle character columns properly we need to convert range values back to strings.
if (colType == WR_CHAR)
{
maxMin->fromToChars();
}
}
/*@convertValArray - Convert interface values to internal values
*/
@ -1182,21 +1212,21 @@ getCPInfoToUpdateForUpdatableType(const ColStruct& colStruct, ExtCPInfo* current
{
return nullptr;
}
switch(colStruct.colDataType)
switch(colStruct.colType)
{
// here we enumerate all supported types.
case CalpontSystemCatalog::TINYINT:
case CalpontSystemCatalog::SMALLINT:
case CalpontSystemCatalog::DECIMAL:
case CalpontSystemCatalog::MEDINT:
case CalpontSystemCatalog::INT:
case CalpontSystemCatalog::BIGINT:
case CalpontSystemCatalog::UTINYINT:
case CalpontSystemCatalog::USMALLINT:
case CalpontSystemCatalog::UDECIMAL:
case CalpontSystemCatalog::UMEDINT:
case CalpontSystemCatalog::UINT:
case CalpontSystemCatalog::UBIGINT:
case WR_BYTE:
case WR_SHORT:
case WR_INT:
case WR_LONGLONG:
case WR_CHAR:
case WR_UBYTE:
case WR_USHORT:
case WR_UINT:
case WR_ULONGLONG:
case WR_MEDINT:
case WR_UMEDINT:
case WR_BINARY:
{
return currentCPInfo;
}