You've already forked mariadb-columnstore-engine
mirror of
https://github.com/mariadb-corporation/mariadb-columnstore-engine.git
synced 2025-07-29 08:21:15 +03:00
Basic SELECT support for Decimal38
This commit is contained in:
committed by
Roman Nozdrin
parent
63dcaa387f
commit
77e1d6abe3
@ -247,6 +247,9 @@ void force_close_fep_conn(THD *thd, cal_connection_info* ci, bool check_prev_rc
|
||||
ci->cal_conn_hndl = 0;
|
||||
}
|
||||
|
||||
// WIP MCOL-641
|
||||
using uint128_t = unsigned __int128;
|
||||
|
||||
void storeNumericField(Field** f, int64_t value, CalpontSystemCatalog::ColType& ct)
|
||||
{
|
||||
// unset null bit first
|
||||
@ -801,15 +804,24 @@ int fetchNextRow(uchar* buf, cal_table_info& ti, cal_connection_info* ci, bool h
|
||||
case CalpontSystemCatalog::DECIMAL:
|
||||
case CalpontSystemCatalog::UDECIMAL:
|
||||
{
|
||||
// WIP MCOL-641
|
||||
if (row.getPrecision(s) > 18)
|
||||
{
|
||||
sscanf(row.getBinaryField(s).c_str(), "%ld",&intColVal);
|
||||
// unset null bit first
|
||||
if ((*f)->null_ptr)
|
||||
*(*f)->null_ptr &= ~(*f)->null_bit;
|
||||
|
||||
const uint128_t val = *reinterpret_cast<const uint128_t*>(row.getBinaryField2(s));
|
||||
char buf[256];
|
||||
dataconvert::DataConvert::decimalToString(val, (unsigned)colType.scale, buf, 256, colType.colDataType);
|
||||
Field_new_decimal* f2 = (Field_new_decimal*)*f;
|
||||
f2->store(buf, strlen(buf), f2->charset());
|
||||
}
|
||||
else
|
||||
{
|
||||
intColVal = row.getIntField(s);
|
||||
storeNumericField(f, intColVal, colType);
|
||||
}
|
||||
storeNumericField(f, intColVal, colType);
|
||||
break;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user