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

sum() and avg() return incorrect result for float when calculation overflows float range

Details

    • Bug
    • Status: Closed (View Workflow)
    • Minor
    • Resolution: Duplicate
    • 1.0.1
    • 1.2.3
    • ExeMgr
    • None

    Description

      Build tested:

      getsoftwareinfo Fri Jun 17 17:03:28 2016

      Name : mariadb-columnstore-platform Relocations: (not relocatable)
      Version : 1.0 Vendor: MariaDB Corporation Ab
      Release : 1 Build Date: Mon 13 Jun 2016 06:50:26 PM CDT
      Install Date: Fri 17 Jun 2016 10:53:22 AM CDT Build Host: srvbuilder
      Group : Applications Source RPM: mariadb-columnstore-1.0-1.src.rpm

      MariaDB [mytest]> select cfloat from datatypetestm;
      -------------

      cfloat

      -------------

      -3.40287e18
      -3.40287e18
      -3.40286e18
      -3.40286e18
      -3.40286e18
      3.40286e18
      3.40286e18
      3.40286e18
      3.40287e18
      3.40287e18
      0

      -------------
      11 rows in set (0.02 sec)

      MariaDB [mytest]> select SUM(CFLOAT) from datatypetestm;
      --------------

      SUM(CFLOAT)

      --------------

      274877906944

      --------------
      1 row in set (0.01 sec)

      MariaDB [mytest]> select AVG(CFLOAT) from datatypetestm;
      -------------

      AVG(CFLOAT)

      -------------

      24988901376

      -------------
      1 row in set (0.01 sec)

      Both MariaDB and InfiniDB return 0.

      Attachments

        Issue Links

          Activity

            This most likely is caused by undetected data overflow.

            David.Hall David Hall (Inactive) added a comment - This most likely is caused by undetected data overflow.

            The accumulation occurs in the return value, which is the same type as the row value. The failed tests overflow the accumulator. Accumulation should take place in a DOUBLE, rather than FLOAT, but it isn't designed that way.

            This behaviour is seen in InfiniDB, so it's not new.

            This is not a trivial fix. Some learning curve on how the thing works is needed.

            David.Hall David Hall (Inactive) added a comment - The accumulation occurs in the return value, which is the same type as the row value. The failed tests overflow the accumulator. Accumulation should take place in a DOUBLE, rather than FLOAT, but it isn't designed that way. This behaviour is seen in InfiniDB, so it's not new. This is not a trivial fix. Some learning curve on how the thing works is needed.

            The system behaves correctly when normal range float (and double) values are utilized, however should the accumulated values exceed the float (or double range) then this behavior will be observed.

            Since this is the existing behavior of infinidb and and an edge case, this is not a priority for beta.

            dthompson David Thompson (Inactive) added a comment - The system behaves correctly when normal range float (and double) values are utilized, however should the accumulated values exceed the float (or double range) then this behavior will be observed. Since this is the existing behavior of infinidb and and an edge case, this is not a priority for beta.

            People

              David.Hall David Hall (Inactive)
              dleeyh Daniel Lee (Inactive)
              Votes:
              1 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Git Integration

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