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

Math with aggregates on constant columns returns incorrect results

    XMLWordPrintable

Details

    • Bug
    • Status: Open (View Workflow)
    • Minor
    • Resolution: Unresolved
    • 1.0.0
    • Icebox
    • ExeMgr, PrimProc
    • 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

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

              Dates

                Created:
                Updated:

                Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.