[MCOL-4309] Math with aggregates on constant columns returns incorrect results Created: 2020-09-15  Updated: 2021-01-14

Status: Open
Project: MariaDB ColumnStore
Component/s: ExeMgr, PrimProc
Affects Version/s: 1.0.0
Fix Version/s: Icebox

Type: Bug Priority: Minor
Reporter: Roman Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: None

Issue Links:
PartOf
is part of MCOL-641 Full DECIMAL support in ColumnStore Closed

 Description   

Here is an example when MCS adds additional scale calculating avg on a constant INT value.

MariaDB [test]> select avg(1111233)+0.5, avg(d1) from (select d1 from cs1) t;
+------------------+-----------------------------+
| avg(1111233)+0.5 | avg(d1)                     |
+------------------+-----------------------------+
|         111.6233 | 2244657667789092030149.0000 |
+------------------+-----------------------------+
1 row in set (0.010 sec)

And here is the expected result:

MariaDB [test]> select avg(1111233)+0.5;
+------------------+
| avg(1111233)+0.5 |
+------------------+
|     1111233.5000 |
+------------------+
1 row in set (0.001 sec)

JFYI The code in RowAggregationUM::doNotNullConstantAggregate saves avg() as an int field setting the scale to 4 (unconditionally I presume).



 Comments   
Comment by David Hall (Inactive) [ 2020-10-28 ]

The Columnstore engine never sees these constant only requests. All processing is allegedly done in Server. So this is a mystery.

Generated at Thu Feb 08 02:49:23 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.