You've already forked mariadb-columnstore-engine
mirror of
https://github.com/mariadb-corporation/mariadb-columnstore-engine.git
synced 2025-08-07 03:22:57 +03:00
Fix truncate and round for char types
This commit is contained in:
committed by
Leonid Fedorov
parent
06fa57966b
commit
5b166a9577
@@ -196,6 +196,13 @@ double Func_round::getDoubleVal(Row& row, FunctionParm& parm, bool& isNull,
|
|||||||
return x;
|
return x;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (execplan::CalpontSystemCatalog::VARCHAR == op_ct.colDataType ||
|
||||||
|
execplan::CalpontSystemCatalog::CHAR == op_ct.colDataType ||
|
||||||
|
execplan::CalpontSystemCatalog::TEXT == op_ct.colDataType)
|
||||||
|
{
|
||||||
|
return getIntVal(row, parm, isNull, op_ct);
|
||||||
|
}
|
||||||
|
|
||||||
if (isUnsigned(op_ct.colDataType))
|
if (isUnsigned(op_ct.colDataType))
|
||||||
{
|
{
|
||||||
return getUintVal(row, parm, isNull, op_ct);
|
return getUintVal(row, parm, isNull, op_ct);
|
||||||
@@ -263,6 +270,13 @@ long double Func_round::getLongDoubleVal(Row& row, FunctionParm& parm, bool& isN
|
|||||||
return x;
|
return x;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (execplan::CalpontSystemCatalog::VARCHAR == op_ct.colDataType ||
|
||||||
|
execplan::CalpontSystemCatalog::CHAR == op_ct.colDataType ||
|
||||||
|
execplan::CalpontSystemCatalog::TEXT == op_ct.colDataType)
|
||||||
|
{
|
||||||
|
return getIntVal(row, parm, isNull, op_ct);
|
||||||
|
}
|
||||||
|
|
||||||
if (isUnsigned(op_ct.colDataType))
|
if (isUnsigned(op_ct.colDataType))
|
||||||
{
|
{
|
||||||
return getUintVal(row, parm, isNull, op_ct);
|
return getUintVal(row, parm, isNull, op_ct);
|
||||||
@@ -484,7 +498,7 @@ IDB_Decimal Func_round::getDecimalVal(Row& row, FunctionParm& parm, bool& isNull
|
|||||||
else
|
else
|
||||||
x = ceil(x - 0.5);
|
x = ceil(x - 0.5);
|
||||||
|
|
||||||
decimal.value = (int64_t)x;
|
decimal.value = x <= INT64_MIN ? INT64_MIN : x >= INT64_MAX ? INT64_MAX : int64_t(x);
|
||||||
decimal.scale = s;
|
decimal.scale = s;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -440,7 +440,7 @@ IDB_Decimal Func_truncate::getDecimalVal(Row& row, FunctionParm& parm, bool& isN
|
|||||||
if (!isNull)
|
if (!isNull)
|
||||||
{
|
{
|
||||||
x *= p;
|
x *= p;
|
||||||
decimal.value = (int64_t)x;
|
decimal.value = x <= INT64_MIN ? INT64_MIN : x >= INT64_MAX ? INT64_MAX : int64_t(x);
|
||||||
decimal.scale = s;
|
decimal.scale = s;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user