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

Merge pull request #1613 from tntnatbry/MCOL-641-alter-table-fix

MCOL-641 Fix alter table add wide decimal column.
This commit is contained in:
Roman Nozdrin
2020-11-26 18:17:01 +03:00
committed by GitHub
32 changed files with 62 additions and 255 deletions

View File

@ -83,10 +83,6 @@ void getEmptyRowValue(const execplan::CalpontSystemCatalog::ColDataType colDataT
datatypes::Decimal::setWideDecimalEmptyValue(*(reinterpret_cast<int128_t*>(emptyVal)));
break;
//case CalpontSystemCatalog::BINARY:
// emptyVal = joblist::BINARYEMPTYROW;
// break;
case execplan::CalpontSystemCatalog::CHAR:
case execplan::CalpontSystemCatalog::VARCHAR:
case execplan::CalpontSystemCatalog::DATE:

View File

@ -126,9 +126,6 @@ uint64_t getNullValue(CalpontSystemCatalog::ColDataType t, uint32_t colWidth)
case CalpontSystemCatalog::UBIGINT:
return joblist::UBIGINTNULL;
case CalpontSystemCatalog::BINARY:
return joblist::BINARYNULLVALUELOW;
case CalpontSystemCatalog::VARBINARY:
default:
ostringstream os;
@ -247,9 +244,6 @@ int64_t getSignedNullValue(CalpontSystemCatalog::ColDataType t, uint32_t colWidt
case CalpontSystemCatalog::LONGDOUBLE:
return (int64_t)joblist::LONGDOUBLENULL;
case CalpontSystemCatalog::BINARY:
return (int64_t)joblist::BINARYNULLVALUELOW;
case CalpontSystemCatalog::VARBINARY:
default:
ostringstream os;

View File

@ -23,11 +23,6 @@
namespace utils
{
const uint64_t BINARYNULLVALUELOW = 0ULL;
const uint64_t BINARYNULLVALUEHIGH = 0x8000000000000000ULL;
const uint64_t BINARYEMPTYVALUELOW = 1ULL;
const uint64_t BINARYEMPTYVALUEHIGH = 0x8000000000000000ULL;
const int128_t minInt128 = int128_t(0x8000000000000000LL) << 64;
const int128_t maxInt128 = (int128_t(0x7FFFFFFFFFFFFFFFLL) << 64) + 0xFFFFFFFFFFFFFFFFLL;

View File

@ -131,15 +131,6 @@ string Func_hex::getStrVal(rowgroup::Row& row,
return string(hexPtr.get(), hexLen);
}
case CalpontSystemCatalog::BINARY:
{
const string& arg = parm[0]->data()->getStrVal(row, isNull);
uint64_t hexLen = arg.size() * 2;
scoped_array<char> hexPtr(new char[hexLen + 1]); // "+ 1" for the last \0
octet2hex(hexPtr.get(), arg.data(), arg.size());
return string(hexPtr.get(), hexLen);
}
default:
{
dec = (uint64_t)parm[0]->data()->getIntVal(row, isNull);

View File

@ -632,10 +632,7 @@ string Row::toString() const
os << " " << dec;
break;
}
// WIP MCOL-641
case CalpontSystemCatalog::BINARY:
std::cout << __FILE__<< ":" <<__LINE__ << " Fix for 16 Bytes ?" << std::endl;
break;
case CalpontSystemCatalog::DECIMAL:
case CalpontSystemCatalog::UDECIMAL:
if (colWidths[i] == datatypes::MAXDECIMALWIDTH)
@ -709,9 +706,6 @@ string Row::toCSV() const
os << dec;
break;
}
case CalpontSystemCatalog::BINARY:
std::cout << __FILE__<< __LINE__ << ":" << "toCSV"<< std::endl;
//fallthrough
default:
os << getIntField(i);
@ -876,11 +870,6 @@ void Row::initToNull()
case CalpontSystemCatalog::UBIGINT:
*((uint64_t*) &data[offsets[i]]) = joblist::UBIGINTNULL;
break;
case CalpontSystemCatalog::BINARY:
{
datatypes::Decimal::setWideDecimalNullValue(reinterpret_cast<int128_t&>(data[offsets[i]]));
}
break;
default:
ostringstream os;
@ -903,29 +892,6 @@ inline bool Row::isNullValue_offset(uint32_t offset) const
throw logic_error(os.str());
}
// WIP Method template resolution could impose some perf degradation
// Compare perf with switch-case
template<>
inline bool
Row::isNullValue_offset<execplan::CalpontSystemCatalog::BINARY,32>(
uint32_t offset) const
{
const uint64_t *intPtr = reinterpret_cast<const uint64_t*>(&data[offset]);
return ((intPtr[0] == static_cast<uint64_t>(utils::BINARYNULLVALUELOW)) &&
(intPtr[1] == static_cast<uint64_t>(utils::BINARYNULLVALUELOW)) &&
(intPtr[2] == static_cast<uint64_t>(utils::BINARYNULLVALUELOW)) &&
(intPtr[3] == static_cast<uint64_t>(utils::BINARYEMPTYVALUEHIGH)));
}
template<>
inline bool
Row::isNullValue_offset<execplan::CalpontSystemCatalog::BINARY,16>(
uint32_t offset) const
{
const int128_t *intPtr = reinterpret_cast<const int128_t*>(&data[offset]);
return datatypes::Decimal::isWideDecimalNullValue (*intPtr);
}
template<>
inline bool
Row::isNullValue_offset<execplan::CalpontSystemCatalog::DECIMAL,16>(
@ -1114,15 +1080,6 @@ bool Row::isNullValue(uint32_t colIndex) const
return (*((long double*) &data[offsets[colIndex]]) == joblist::LONGDOUBLENULL);
break;
case CalpontSystemCatalog::BINARY:
{
const uint32_t len = 16;
uint32_t* lenPtr = const_cast<uint32_t*>(&len);
*lenPtr = getColumnWidth(colIndex);
return isNullValue_offset
<execplan::CalpontSystemCatalog::BINARY,len>(offsets[colIndex]);
}
default:
{
ostringstream os;
@ -1787,9 +1744,6 @@ void RowGroup::addToSysDataList(execplan::CalpontSystemCatalog::NJLSysDataList&
cr->PutData(row.getUintField<4>(j));
break;
case CalpontSystemCatalog::BINARY:
std::cout << __FILE__<< __LINE__ << __func__<< std::endl;
//fallthrough
default:
cr->PutData(row.getIntField<8>(j));
}

View File

@ -69,12 +69,6 @@ boost::shared_ptr<WindowFunctionType> WF_count<T>::makeFunction(int id, const st
break;
}
case CalpontSystemCatalog::BINARY:
{
std::cout << __FILE__<< ":" <<__LINE__ << " Fix for 16 Bytes ?" << std::endl;
break;
}
case CalpontSystemCatalog::DECIMAL:
case CalpontSystemCatalog::UDECIMAL:
{

View File

@ -491,9 +491,7 @@ bool WF_udaf::dropValues(int64_t b, int64_t e)
datum.columnData = valIn;
break;
}
case CalpontSystemCatalog::BINARY:
cout << __FILE__<< ":" <<__LINE__ << " Fix for 16 Bytes ?" << endl;
//fallthrough
default:
{
string errStr = "(" + colType2String[(int)datum.dataType] + ")";
@ -768,9 +766,7 @@ void WF_udaf::SetUDAFValue(static_any::any& valOut, int64_t colOut,
setValue(colDataType, b, e, c, &strOut);
}
break;
case CalpontSystemCatalog::BINARY:
cout << __FILE__<< ":" <<__LINE__ << " Fix for 16 Bytes ?" << endl;
//fallthrough
default:
{
std::ostringstream errmsg;
@ -1150,9 +1146,7 @@ void WF_udaf::operator()(int64_t b, int64_t e, int64_t c)
datum.columnData = valIn;
break;
}
case CalpontSystemCatalog::BINARY:
cout << __FILE__<< ":" <<__LINE__ << " Fix for 16 Bytes ?" << endl;
//fallthrough
default:
{
string errStr = "(" + colType2String[(int)datum.dataType] + ")";

View File

@ -799,9 +799,7 @@ void* WindowFunctionType::getNullValueByType(int ct, int pos)
case CalpontSystemCatalog::LONGDOUBLE:
v = &longDoubleNull;
break;
case CalpontSystemCatalog::BINARY:
cout << __FILE__<< ":" <<__LINE__ << " Fix for 16 Bytes ?" << endl;
//fallthrough
case CalpontSystemCatalog::VARBINARY:
default:
std::ostringstream oss;