1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-07-29 08:21:15 +03:00

fix(MCOL-5889): Improper handle of DOUBLE result type with DECIMAL arguments

Sometimes server assigns DOUBLE type for arithmetic operations over
DECIMAL arguments. In this rare case width of result was incorrectly
adjusted and it triggered an assertion.

Now width of result gets adjusted only if result type is also DECIMAL.
This commit is contained in:
Serguey Zefiov
2025-02-10 20:18:06 +00:00
committed by Leonid Fedorov
parent 0208758e3b
commit 6e539b8336
4 changed files with 57 additions and 1 deletions

View File

@ -4019,7 +4019,8 @@ ReturnedColumn* buildArithmeticColumnBody(Item_func* item, gp_walk_info& gwi, bo
int32_t leftColWidth = leftColType.colWidth;
int32_t rightColWidth = rightColType.colWidth;
if (leftColWidth == datatypes::MAXDECIMALWIDTH || rightColWidth == datatypes::MAXDECIMALWIDTH)
if ((leftColWidth == datatypes::MAXDECIMALWIDTH || rightColWidth == datatypes::MAXDECIMALWIDTH)
&& datatypes::isDecimal(mysqlType.colDataType))
{
mysqlType.colWidth = datatypes::MAXDECIMALWIDTH;