You've already forked mariadb-columnstore-engine
mirror of
https://github.com/mariadb-corporation/mariadb-columnstore-engine.git
synced 2025-07-30 19:23:07 +03:00
MCOL-4188 Regression fixes for MCOL-641.
1. Make PredicateOperator::setOpType() function wide decimal aware. 2. Added support for wide decimal in jlf_subquery.cpp::getColumnValue() used in scalar subqueries. 3. Fixed the column index used for fetching wide decimal values from a Row when a wide decimal field is used in the order by clause.
This commit is contained in:
@ -215,7 +215,9 @@ void PredicateOperator::setOpType(Type& l, Type& r)
|
|||||||
{
|
{
|
||||||
// should following the result type that MySQL gives
|
// should following the result type that MySQL gives
|
||||||
fOperationType = l;
|
fOperationType = l;
|
||||||
fOperationType.scale = (l.scale > r.scale ? l.scale : r.scale);
|
fOperationType.scale = std::max(l.scale, r.scale);
|
||||||
|
fOperationType.precision = std::max(l.precision, r.precision);
|
||||||
|
fOperationType.colWidth = std::max(l.colWidth, r.colWidth);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -229,7 +231,9 @@ void PredicateOperator::setOpType(Type& l, Type& r)
|
|||||||
case execplan::CalpontSystemCatalog::UBIGINT:
|
case execplan::CalpontSystemCatalog::UBIGINT:
|
||||||
fOperationType.colDataType = execplan::CalpontSystemCatalog::DECIMAL;
|
fOperationType.colDataType = execplan::CalpontSystemCatalog::DECIMAL;
|
||||||
fOperationType.scale = l.scale;
|
fOperationType.scale = l.scale;
|
||||||
fOperationType.colWidth = 8;
|
fOperationType.precision = l.precision;
|
||||||
|
fOperationType.colWidth = (l.colWidth == datatypes::MAXDECIMALWIDTH) ?
|
||||||
|
l.colWidth : 8;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@ -261,7 +265,9 @@ void PredicateOperator::setOpType(Type& l, Type& r)
|
|||||||
case execplan::CalpontSystemCatalog::UBIGINT:
|
case execplan::CalpontSystemCatalog::UBIGINT:
|
||||||
fOperationType.colDataType = execplan::CalpontSystemCatalog::DECIMAL;
|
fOperationType.colDataType = execplan::CalpontSystemCatalog::DECIMAL;
|
||||||
fOperationType.scale = r.scale;
|
fOperationType.scale = r.scale;
|
||||||
fOperationType.colWidth = 8;
|
fOperationType.precision = r.precision;
|
||||||
|
fOperationType.colWidth = (r.colWidth == datatypes::MAXDECIMALWIDTH) ?
|
||||||
|
r.colWidth : 8;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case execplan::CalpontSystemCatalog::LONGDOUBLE:
|
case execplan::CalpontSystemCatalog::LONGDOUBLE:
|
||||||
|
@ -90,19 +90,23 @@ void getColumnValue(ConstantColumn** cc, uint64_t i, const Row& row, const strin
|
|||||||
|
|
||||||
case CalpontSystemCatalog::DECIMAL:
|
case CalpontSystemCatalog::DECIMAL:
|
||||||
case CalpontSystemCatalog::UDECIMAL:
|
case CalpontSystemCatalog::UDECIMAL:
|
||||||
data = row.getIntField(i);
|
if (row.getColumnWidth(i) == datatypes::MAXDECIMALWIDTH)
|
||||||
oss << (data / IDB_pow[row.getScale(i)]);
|
|
||||||
|
|
||||||
if (row.getScale(i) > 0)
|
|
||||||
{
|
{
|
||||||
if (data > 0)
|
int128_t val;
|
||||||
oss << "." << (data % IDB_pow[row.getScale(i)]);
|
row.getInt128Field(i, val);
|
||||||
else if (data < 0)
|
|
||||||
oss << "." << (-data % IDB_pow[row.getScale(i)]);
|
|
||||||
}
|
|
||||||
|
|
||||||
*cc = new ConstantColumn(oss.str(),
|
IDB_Decimal dec(0, row.getScale(i), row.getPrecision(i), val);
|
||||||
IDB_Decimal(data, row.getScale(i), row.getPrecision(i)));
|
|
||||||
|
*cc = new ConstantColumn(dec.toString(true), dec);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
data = row.getIntField(i);
|
||||||
|
|
||||||
|
IDB_Decimal dec(data, row.getScale(i), row.getPrecision(i));
|
||||||
|
|
||||||
|
*cc = new ConstantColumn(dec.toString(), dec);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CalpontSystemCatalog::UTINYINT:
|
case CalpontSystemCatalog::UTINYINT:
|
||||||
@ -119,7 +123,6 @@ void getColumnValue(ConstantColumn** cc, uint64_t i, const Row& row, const strin
|
|||||||
oss << fixed << row.getFloatField(i);
|
oss << fixed << row.getFloatField(i);
|
||||||
*cc = new ConstantColumn(oss.str(), (double) row.getFloatField(i));
|
*cc = new ConstantColumn(oss.str(), (double) row.getFloatField(i));
|
||||||
break;
|
break;
|
||||||
break;
|
|
||||||
|
|
||||||
case CalpontSystemCatalog::DOUBLE:
|
case CalpontSystemCatalog::DOUBLE:
|
||||||
oss << fixed << row.getDoubleField(i);
|
oss << fixed << row.getDoubleField(i);
|
||||||
|
@ -172,8 +172,11 @@ int WideDecimalCompare::operator()(IdbCompare* l, Row::Pointer r1, Row::Pointer
|
|||||||
l->row2().setData(r2);
|
l->row2().setData(r2);
|
||||||
|
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
int128_t v1 = *(l->row1().getBinaryField_offset<int128_t>(keyColumnOffset));
|
|
||||||
int128_t v2 = *(l->row2().getBinaryField_offset<int128_t>(keyColumnOffset));
|
int128_t v1, v2;
|
||||||
|
l->row1().getInt128Field(fSpec.fIndex, v1);
|
||||||
|
l->row2().getInt128Field(fSpec.fIndex, v2);
|
||||||
|
|
||||||
bool v1IsNull = v1 == datatypes::Decimal128Null;
|
bool v1IsNull = v1 == datatypes::Decimal128Null;
|
||||||
bool v2IsNull = v2 == datatypes::Decimal128Null;
|
bool v2IsNull = v2 == datatypes::Decimal128Null;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user