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

MCOL-5215 Fix overflow of UNION operation involving DECIMAL datatypes.

When a UNION operation involving DECIMAL datatypes with scale and digits
before the decimal exceeds the currently supported maximum precision
of 38, we throw an error to the user:
"MCS-2060: Union operation exceeds maximum DECIMAL precision of 38".

This is until MCOL-5417 is implemented where ColumnStore will have
full parity with MariaDB server in terms of maximum supported DECIMAL
precision and scale of 65 and 38 digits respectively.
This commit is contained in:
Gagan Goel
2023-02-17 05:22:34 -05:00
parent 8cdcae0d2f
commit 86dcf92d56
10 changed files with 123 additions and 70 deletions

View File

@ -5102,11 +5102,18 @@ SJSTEP unionQueries(JobStepVector& queries, uint64_t distinctUnionNum, JobInfo&
unionStep->inputAssociation(jsaToUnion);
unionStep->outputAssociation(jsa);
// This return code in the call to convertUnionColType() below would
// always be 0. This is because convertUnionColType() is also called
// in the connector code in getSelectPlan()/getGroupPlan() which handle
// the non-zero return code scenarios from this function call and error
// out, in which case, the execution does not even get to ExeMgr.
unsigned int dummyUnionedTypeRc = 0;
// get unioned column types
for (uint64_t j = 0; j < colCount; ++j)
{
CalpontSystemCatalog::ColType colType =
CalpontSystemCatalog::ColType::convertUnionColType(queryColTypes[j]);
CalpontSystemCatalog::ColType::convertUnionColType(queryColTypes[j], dummyUnionedTypeRc);
types.push_back(colType.colDataType);
csNums.push_back(colType.charsetNumber);
scale.push_back(colType.scale);