1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-08-01 06:46:55 +03:00

Merge pull request #2029 from tntnatbry/MCOL-641-cleanup

MCOL-641 Cleanup.
This commit is contained in:
Roman Nozdrin
2021-07-06 14:35:21 +03:00
committed by GitHub
29 changed files with 59 additions and 85 deletions

View File

@ -47,7 +47,7 @@ ArithmeticOperator::ArithmeticOperator(const string& operatorName): Operator(ope
ArithmeticOperator::ArithmeticOperator(const ArithmeticOperator& rhs):
Operator(rhs),
fTimeZone(rhs.timeZone()),
fDecimalOverflowCheck(false)
fDecimalOverflowCheck(rhs.getOverflowCheck())
{
}

View File

@ -129,7 +129,7 @@ ColumnCommandDataType::ColumnCommandDataType(const CalpontSystemCatalog::DataTyp
colWidth = 8;
mIsDict = true;
}
// MCOL-641 WIP
// TODO MCOL-641
else if (colWidth > 8
&& colDataType != CalpontSystemCatalog::DECIMAL
&& colDataType != CalpontSystemCatalog::UDECIMAL)

View File

@ -264,7 +264,7 @@ public:
{
if (scaleDiff > 0)
{
// WIP MCOL-641 Unconditional overflow check
// TODO MCOL-641 Unconditional overflow check
datatypes::MultiplicationNoOverflowCheck mul;
mul(decimal.s128Value, scaleMultiplier, decimal.s128Value);
}

View File

@ -118,15 +118,15 @@ public:
void setOpType(Type& l, Type& r);
private:
inline bool numericCompare(IDB_Decimal& op1, IDB_Decimal& op2);
inline bool numericCompare(const IDB_Decimal& op1, const IDB_Decimal& op2);
template <typename result_t>
inline bool numericCompare(result_t op1, result_t op2);
inline bool numericCompare(const result_t op1, const result_t op2);
inline bool strTrimCompare(const std::string& op1, const std::string& op2);
const CHARSET_INFO* cs;
};
inline bool PredicateOperator::numericCompare(IDB_Decimal& op1, IDB_Decimal& op2)
inline bool PredicateOperator::numericCompare(const IDB_Decimal& op1, const IDB_Decimal& op2)
{
switch (fOp)
{
@ -158,7 +158,7 @@ inline bool PredicateOperator::numericCompare(IDB_Decimal& op1, IDB_Decimal& op2
}
template <typename result_t>
inline bool PredicateOperator::numericCompare(result_t op1, result_t op2)
inline bool PredicateOperator::numericCompare(const result_t op1, const result_t op2)
{
switch (fOp)
{

View File

@ -483,7 +483,7 @@ void SimpleColumn::setDerivedTable()
// @todo make aggregate filter to having clause. not optimize it for now
if (fDerivedRefCol &&
// WIP replace with typeid()
// TODO replace with typeid()
(dynamic_cast<AggregateColumn*>(fDerivedRefCol) ||
dynamic_cast<WindowFunctionColumn*>(fDerivedRefCol)))
fDerivedTable = "";
@ -502,7 +502,7 @@ bool SimpleColumn::singleTable(CalpontSystemCatalog::TableAliasName& tan)
// @todo move to inline
void SimpleColumn::evaluate(Row& row, bool& isNull)
{
// WIP Move this block into an appropriate place
// TODO Move this block into an appropriate place
if (UNLIKELY((int)(fInputOffset == (uint32_t)-1)))
{
fInputOffset = row.getOffset(fInputIndex);

View File

@ -143,7 +143,7 @@ void SimpleColumn_Decimal<len>::setNullVal()
fNullVal = joblist::TINYINTNULL;
break;
case 16:
std::cout << __FILE__<< ":" <<__LINE__ << " Fix for 16 Bytes ?" << std::endl;
// TODO MCOL-641
//fallthrough
default:
fNullVal = joblist::BIGINTNULL;
@ -233,8 +233,8 @@ void SimpleColumn_Decimal<len>::serialize(messageqcpp::ByteStream& b) const
case 8:
b << (ObjectReader::id_t) ObjectReader::SIMPLECOLUMN_DECIMAL8;
break;
case 16:
std::cout << __FILE__<< ":" <<__LINE__ << " Fix for 16 Bytes ?" << std::endl;
// TODO MCOL-641
// case 16:
}
SimpleColumn::serialize(b);
@ -260,8 +260,8 @@ void SimpleColumn_Decimal<len>::unserialize(messageqcpp::ByteStream& b)
case 8:
ObjectReader::checkType(b, ObjectReader::SIMPLECOLUMN_DECIMAL8);
break;
case 16:
std::cout << __FILE__<< ":" <<__LINE__ << " Fix 16 Bytes ?" << std::endl;
// TODO MCOL-641
// case 16:
}
SimpleColumn::unserialize(b);

View File

@ -142,8 +142,8 @@ void SimpleColumn_UINT<len>::setNullVal()
case 1:
fNullVal = joblist::UTINYINTNULL;
break;
// TODO MCOL-641
case 16:
std::cout << __FILE__<< ":" <<__LINE__ << " Fix 16 Bytes ?" << std::endl;
//fallthrough
default:
fNullVal = joblist::UBIGINTNULL;
@ -245,8 +245,9 @@ void SimpleColumn_UINT<len>::serialize(messageqcpp::ByteStream& b) const
case 8:
b << (ObjectReader::id_t) ObjectReader::SIMPLECOLUMN_UINT8;
break;
case 16:
std::cout << __FILE__<< ":" <<__LINE__ << " Fix 16 Bytes ?" << std::endl;
// TODO MCOL-641
// case 16:
}
SimpleColumn::serialize(b);
@ -272,8 +273,9 @@ void SimpleColumn_UINT<len>::unserialize(messageqcpp::ByteStream& b)
case 8:
ObjectReader::checkType(b, ObjectReader::SIMPLECOLUMN_UINT8);
break;
case 16:
std::cout << __FILE__<< ":" <<__LINE__ << " Fix 16 Bytes ?" << std::endl;
// TODO MCOL-641
// case 16:
}
SimpleColumn::unserialize(b);

View File

@ -489,8 +489,9 @@ void WindowFunctionColumn::evaluate(Row& row, bool& isNull)
fResult.origIntVal = row.getUintField<8>(fInputIndex);
break;
// TODO MCOL-641
case 16:
cout << __FILE__<< ":" <<__LINE__ << " Fix 16 Bytes ?" << endl;
//fallthrough
default:
if (row.equals(CPNULLSTRMARK, fInputIndex))

View File

@ -680,8 +680,9 @@ void BatchPrimitiveProcessorJL::getTuples(messageqcpp::ByteStream& in,
columnData[j]++;
pos++;
break;
// TODO MCOL-641
case 16:
cout << __FILE__<< ":" <<__LINE__ << " Fix 16 Bytes ?" << endl;
//fallthrough
default:
cout << "BPP::getTuples(): bad column width of " << colWidths[j]

View File

@ -256,9 +256,11 @@ uint8_t ColumnCommandJL::getTableColumnType()
case 1:
return TableColumn::UINT8;
// TODO MCOL-641
case 16:
cout << __FILE__<< ":" <<__LINE__ << " Fix 16 Bytes ?" << endl;
//fallthrough
default:
throw logic_error("ColumnCommandJL: bad column width");
}

View File

@ -1885,9 +1885,7 @@ const JobStepVector doSimpleFilter(SimpleFilter* sf, JobInfo& jobInfo)
#else
bool isNull = ConstantColumn::NULLDATA == cc->type();
// WIP MCOL-641 width check must be a f() not a literal
// make a template from convertValueNum to avoid extra if
// this condition doesn't support UDECIMAL
if (ct.isWideDecimalType())
convertValueNum(constval, ct, isNull, rf, jobInfo.timeZone, value128);
else

View File

@ -597,7 +597,6 @@ void pColStep::addFilter(int8_t COP, int64_t value, uint8_t roundFlag)
fFilterCount++;
}
// WIP MCOL-641
void pColStep::addFilter(int8_t COP, const int128_t& value, uint8_t roundFlag)
{
fFilterString << (uint8_t) COP;

View File

@ -196,7 +196,6 @@ public:
*/
void addFilter(int8_t COP, int64_t value, uint8_t roundFlag = 0);
void addFilter(int8_t COP, float value);
// WIP MCOL-641
void addFilter(int8_t COP, const int128_t& value, uint8_t roundFlag = 0);
/** @brief Sets the DataList to get RID values from.

View File

@ -380,8 +380,8 @@ float RowEstimator::estimateRowReturnFactor(const BRM::EMEntry& emEntry,
if (ct.colDataType == execplan::CalpontSystemCatalog::DECIMAL ||
ct.colDataType == execplan::CalpontSystemCatalog::UDECIMAL)
{
uint128_t val = *(uint128_t*)msgDataPtr;
bigValue = static_cast<int128_t>(val);
datatypes::TSInt128 val(reinterpret_cast<const int128_t*>(msgDataPtr));
bigValue = val.getValue();
break;
}
}
@ -426,8 +426,8 @@ float RowEstimator::estimateRowReturnFactor(const BRM::EMEntry& emEntry,
if (ct.colDataType == execplan::CalpontSystemCatalog::DECIMAL ||
ct.colDataType == execplan::CalpontSystemCatalog::UDECIMAL)
{
int128_t val = *(int128_t*)msgDataPtr;
bigValue = static_cast<int128_t>(val);
datatypes::TSInt128 val(reinterpret_cast<const int128_t*>(msgDataPtr));
bigValue = val.getValue();
break;
}
}

View File

@ -1484,7 +1484,7 @@ bool TupleBPS::processSingleFilterString(int8_t BOP, int8_t colWidth, T val, con
{
int8_t COP;
int64_t val2;
int128_t bigVal2;
datatypes::TSInt128 bigVal2;
bool thisPredicate;
COP = *filterString++;
filterString++; // skip the round var, don't think that applies here
@ -1512,7 +1512,7 @@ bool TupleBPS::processSingleFilterString(int8_t BOP, int8_t colWidth, T val, con
break;
case 16:
bigVal2 = *((int128_t*) filterString);
bigVal2 = reinterpret_cast<const int128_t*>(filterString);
filterString += 16;
break;
@ -1524,7 +1524,7 @@ bool TupleBPS::processSingleFilterString(int8_t BOP, int8_t colWidth, T val, con
if (static_cast<uint8_t>(colWidth) < datatypes::MAXDECIMALWIDTH)
thisPredicate = compareSingleValue(COP, (int64_t) val, val2);
else
thisPredicate = compareSingleValue(COP, (int128_t) val, bigVal2);
thisPredicate = compareSingleValue(COP, (int128_t) val, bigVal2.getValue());
if (j == 0)
ret = thisPredicate;

View File

@ -5148,9 +5148,9 @@ because it has multiple arguments.";
// adjust decimal result type according to internalDecimalScale
bool isWideDecimal = ac->resultType().isWideDecimalType();
// This must be also valid for UDECIMAL
if (!isWideDecimal && gwi.internalDecimalScale >= 0
&& ac->resultType().colDataType == CalpontSystemCatalog::DECIMAL)
if (!isWideDecimal && gwi.internalDecimalScale >= 0 &&
(ac->resultType().colDataType == CalpontSystemCatalog::DECIMAL ||
ac->resultType().colDataType == CalpontSystemCatalog::UDECIMAL))
{
CalpontSystemCatalog::ColType ct = ac->resultType();
ct.scale = gwi.internalDecimalScale;