Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-40679

VAR_SAMP (and VAR_POP / STDDEV_SAMP) over BIGINT UNSIGNED values near 2^64 is insertion-order dependent

    XMLWordPrintable

Details

    • Bug
    • Status: Confirmed (View Workflow)
    • Major
    • Resolution: Unresolved
    • 10.11, 11.4, 11.8, 12.3, 11.4.12
    • 10.11, 11.4, 11.8, 12.3
    • Optimizer
    • mariadb 11.4.12-MariaDB-ubu2404
    • Unexpected results

    Description

      I noticed that VAR_SAMP (and VAR_POP / STDDEV_SAMP) functions over BIGINT UNSIGNED values near 2^64 is insertion-order dependent, making the results non-deterministic. This might be unexpected

      CREATE TABLE t (sh BIGINT UNSIGNED);
      INSERT INTO t VALUES (18446744073709551588), (18446744073709549824);
      SELECT VAR_SAMP(sh) FROM t;   -- 4194304.0
       
      CREATE TABLE t (sh BIGINT UNSIGNED);
      INSERT INTO t VALUES (18446744073709549824), (18446744073709551588);
      SELECT VAR_SAMP(sh) FROM t;   -- 0.0
      

      Attachments

        Activity

          People

            psergei Sergei Petrunia
            jesse0623 Junwen An
            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.