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

Update. The class Row has to be updated to contain ColType info abu columns instead of ColDataType.

This commit is contained in:
Nedeljko Stefanovic
2025-07-04 10:44:54 +00:00
parent d7ee669696
commit 54800de255
9 changed files with 30 additions and 11 deletions

View File

@@ -1191,14 +1191,13 @@ class TypeHandlerEnum : public TypeHandler
} }
boost::any getNullValueForType(const SystemCatalog::TypeAttributesStd& /*attr*/) const override boost::any getNullValueForType(const SystemCatalog::TypeAttributesStd& /*attr*/) const override
{ {
// TODO: How to communicate with write engine?
return {}; return {};
} }
boost::any convertFromString(const SystemCatalog::TypeAttributesStd& /*colType*/, boost::any convertFromString(const SystemCatalog::TypeAttributesStd& /*colType*/,
const ConvertFromStringParam& /*prm*/, const std::string& /*str*/, const ConvertFromStringParam& /*prm*/, const std::string& /*str*/,
bool& /*pushWarning*/) const override; bool& /*pushWarning*/) const override;
const uint8_t* getEmptyValueForType(const SystemCatalog::TypeAttributesStd& /*attr*/) const override const uint8_t* getEmptyValueForType(const SystemCatalog::TypeAttributesStd& /*attr*/) const override
{ {
idbassert(0); idbassert(0);
return nullptr; return nullptr;

View File

@@ -314,12 +314,7 @@ boost::any DDLIndexPopulator::convertData(const CalpontSystemCatalog::ColType& c
switch (colType.colDataType) switch (colType.colDataType)
{ {
case CalpontSystemCatalog::BIT: case CalpontSystemCatalog::BIT:
case CalpontSystemCatalog::ENUM: case CalpontSystemCatalog::ENUM: return colType.fEnumValues[data];
{
string strData(colType.fEnumValues[data]);
return *reinterpret_cast<string*>(&strData);
}
case execplan::CalpontSystemCatalog::TINYINT: return *reinterpret_cast<char*>(&data); case execplan::CalpontSystemCatalog::TINYINT: return *reinterpret_cast<char*>(&data);
case execplan::CalpontSystemCatalog::SMALLINT: return *reinterpret_cast<short*>(&data); case execplan::CalpontSystemCatalog::SMALLINT: return *reinterpret_cast<short*>(&data);
@@ -467,7 +462,8 @@ bool DDLIndexPopulator::checkNotNull(const IdxTuple& data, const CalpontSystemCa
case CalpontSystemCatalog::BIT: break; case CalpontSystemCatalog::BIT: break;
case execplan::CalpontSystemCatalog::ENUM: case execplan::CalpontSystemCatalog::ENUM:
isNull = any_cast<short>(data.data) == any_cast<short>(nullvalue); isNull = (any_cast<unsigned>(data.data) == any_cast<unsigned>(nullvalue)) ||
(any_cast<unsigned>(data.data)==colType.enumVals.size());
break; break;
case execplan::CalpontSystemCatalog::TINYINT: case execplan::CalpontSystemCatalog::TINYINT:

View File

@@ -487,6 +487,14 @@ void AggregateColumn::evaluate(Row& row, bool& isNull)
break; break;
case CalpontSystemCatalog::ENUM:
if ((row.equals<2>(USMALLINTNULL, fInputIndex)) || (row.getUintField<2>(fInputIndex) == USMALLINTNULL))
isNull = true;
else
fResult.uintVal = row.getUintField<2>(fInputIndex);
break;
case CalpontSystemCatalog::TINYINT: case CalpontSystemCatalog::TINYINT:
if (row.equals<1>(TINYINTNULL, fInputIndex)) if (row.equals<1>(TINYINTNULL, fInputIndex))
isNull = true; isNull = true;

View File

@@ -289,6 +289,8 @@ inline void ArithmeticOperator::evaluate(rowgroup::Row& row, bool& isNull, Parse
fResult.uintVal = static_cast<uint64_t>(result); fResult.uintVal = static_cast<uint64_t>(result);
} }
break; break;
case execplan::CalpontSystemCatalog::ENUM:
case execplan::CalpontSystemCatalog::UINT: case execplan::CalpontSystemCatalog::UINT:
case execplan::CalpontSystemCatalog::UMEDINT: case execplan::CalpontSystemCatalog::UMEDINT:
case execplan::CalpontSystemCatalog::USMALLINT: case execplan::CalpontSystemCatalog::USMALLINT:

View File

@@ -731,6 +731,7 @@ void SimpleColumn::evaluate(Row& row, bool& isNull)
break; break;
} }
case CalpontSystemCatalog::ENUM:
case CalpontSystemCatalog::USMALLINT: case CalpontSystemCatalog::USMALLINT:
{ {
fResult.uintVal = row.getUintField<2>(fInputIndex); fResult.uintVal = row.getUintField<2>(fInputIndex);

View File

@@ -474,6 +474,16 @@ inline const utils::NullString& TreeNode::getStrVal(const long timeZone)
{ {
switch (fResultType.colDataType) switch (fResultType.colDataType)
{ {
case CalpontSystemCatalog::ENUM:
if (fResult.uintVal<fResultType.enumVals.size()) {
fResult.strVal.assign(fResultType.enumVals[fResult.uintVal]);
} else {
fResult.strVal.dropString();
}
break;
case CalpontSystemCatalog::VARCHAR: case CalpontSystemCatalog::VARCHAR:
if (fResultType.colWidth <= 7) if (fResultType.colWidth <= 7)
{ {
@@ -713,6 +723,7 @@ inline int64_t TreeNode::getIntVal()
case CalpontSystemCatalog::MEDINT: case CalpontSystemCatalog::MEDINT:
case CalpontSystemCatalog::INT: return fResult.intVal; case CalpontSystemCatalog::INT: return fResult.intVal;
case CalpontSystemCatalog::ENUM:
case CalpontSystemCatalog::UBIGINT: case CalpontSystemCatalog::UBIGINT:
case CalpontSystemCatalog::UTINYINT: case CalpontSystemCatalog::UTINYINT:
case CalpontSystemCatalog::USMALLINT: case CalpontSystemCatalog::USMALLINT:
@@ -764,6 +775,7 @@ inline uint64_t TreeNode::getUintVal()
case CalpontSystemCatalog::MEDINT: case CalpontSystemCatalog::MEDINT:
case CalpontSystemCatalog::INT: return fResult.intVal; case CalpontSystemCatalog::INT: return fResult.intVal;
case CalpontSystemCatalog::ENUM:
case CalpontSystemCatalog::UBIGINT: case CalpontSystemCatalog::UBIGINT:
case CalpontSystemCatalog::UTINYINT: case CalpontSystemCatalog::UTINYINT:
case CalpontSystemCatalog::USMALLINT: case CalpontSystemCatalog::USMALLINT:

View File

@@ -610,6 +610,7 @@ void WindowFunctionColumn::evaluate(Row& row, bool& isNull)
break; break;
} }
case CalpontSystemCatalog::ENUM:
case CalpontSystemCatalog::USMALLINT: case CalpontSystemCatalog::USMALLINT:
{ {
if (row.equals<2>(USMALLINTNULL, fInputIndex)) if (row.equals<2>(USMALLINTNULL, fInputIndex))

View File

@@ -250,6 +250,7 @@ T CrossEngineStep::convertValueNum(const char* str, const CalpontSystemCatalog::
case CalpontSystemCatalog::SMALLINT: rv = boost::any_cast<int16_t>(anyVal); break; case CalpontSystemCatalog::SMALLINT: rv = boost::any_cast<int16_t>(anyVal); break;
case CalpontSystemCatalog::ENUM:
case CalpontSystemCatalog::USMALLINT: rv = boost::any_cast<uint16_t>(anyVal); break; case CalpontSystemCatalog::USMALLINT: rv = boost::any_cast<uint16_t>(anyVal); break;
case CalpontSystemCatalog::MEDINT: case CalpontSystemCatalog::MEDINT:

View File

@@ -29,7 +29,6 @@
namespace joblist namespace joblist
{ {
const uint64_t ENUMNULL = 0xffff;
const uint64_t BIGINTNULL = 0x8000000000000000ULL; const uint64_t BIGINTNULL = 0x8000000000000000ULL;
const uint64_t BIGINTEMPTYROW = 0x8000000000000001ULL; const uint64_t BIGINTEMPTYROW = 0x8000000000000001ULL;
const uint32_t INTNULL = 0x80000000; const uint32_t INTNULL = 0x80000000;