Uploaded image for project: 'MariaDB ColumnStore'
  1. MariaDB ColumnStore
  2. MCOL-4309

Math with aggregates on constant columns returns incorrect results

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open (View Workflow)
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 1.0.0
    • Fix Version/s: None
    • Component/s: ExeMgr, PrimProc
    • Labels:
      None

      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).

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              Unassigned
              Reporter:
              drrtuy Roman
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated: