1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-07-30 19:23:07 +03:00

MCOL-4871 Bar's patch to do proper extent elimination for short CHAR

This commit is contained in:
Roman Nozdrin
2021-12-17 12:40:37 +00:00
parent 753fc26dda
commit 7b5845a4aa
2 changed files with 45 additions and 4 deletions

View File

@ -90,7 +90,7 @@ static int generate_result(BRM::OID_t oid, BRM::DBRM* emp, TABLE* table, THD* th
else
{
table->field[4]->set_notnull();
table->field[4]->store(iter->partition.cprange.loVal);
table->field[4]->store((longlong) iter->partition.cprange.loVal, false);
}
if (iter->partition.cprange.hiVal <= (std::numeric_limits<int64_t>::min() + 1))
@ -100,7 +100,7 @@ static int generate_result(BRM::OID_t oid, BRM::DBRM* emp, TABLE* table, THD* th
else
{
table->field[5]->set_notnull();
table->field[5]->store(iter->partition.cprange.hiVal);
table->field[5]->store((longlong) iter->partition.cprange.hiVal, false);
}
}
else

View File

@ -879,6 +879,47 @@ inline void updateMinMax(T& Min, T& Max, const T curValue, NewColRequestHeader*
Max = curValue;
}
// The next templates group sets initial Min/Max values in filterColumnData.
template<ENUM_KIND KIND, typename T,
typename std::enable_if<KIND == KIND_TEXT, T>::type* = nullptr>
T getInitialMin(NewColRequestHeader* in)
{
const CHARSET_INFO &cs = in->colType.getCharset();
T Min = 0;
cs.max_str((uchar*) &Min, sizeof(Min), sizeof(Min));
return Min;
}
template<ENUM_KIND KIND, typename T,
typename std::enable_if<KIND != KIND_TEXT, T>::type* = nullptr>
T getInitialMin(NewColRequestHeader* in)
{
return datatypes::numeric_limits<T>::max();
}
template<ENUM_KIND KIND, typename T,
typename std::enable_if<KIND != KIND_TEXT && KIND != KIND_UNSIGNED, T>::type* = nullptr>
T getInitialMax(NewColRequestHeader* in)
{
return datatypes::numeric_limits<T>::min();
}
template<ENUM_KIND KIND, typename T,
typename std::enable_if<KIND == KIND_UNSIGNED, T>::type* = nullptr>
T getInitialMax(NewColRequestHeader* in)
{
return 0;
}
template<ENUM_KIND KIND, typename T,
typename std::enable_if<KIND == KIND_TEXT, T>::type* = nullptr>
T getInitialMax(NewColRequestHeader* in)
{
const CHARSET_INFO &cs = in->colType.getCharset();
T Max = 0;
cs.min_str((uchar*) &Max, sizeof(Max), sizeof(Max));
return Max;
}
/*****************************************************************************
*** READ COLUMN VALUES ******************************************************
@ -1667,8 +1708,8 @@ void filterColumnData(
// ###########################
// Boolean indicating whether to capture the min and max values
bool validMinMax = isMinMaxValid(in);
T Min = datatypes::numeric_limits<T>::max();
T Max = (KIND == KIND_UNSIGNED) ? 0 : datatypes::numeric_limits<T>::min();
T Min = getInitialMin<KIND,T>(in);
T Max = getInitialMax<KIND,T>(in);
// Vectorized scanning/filtering for all numerics except float/double types.
// If the total number of input values can't fill a vector the vector path