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

Window Function Expressions Wrong Results

Details

    Description

      The following query returns incorrect results:

      create table t(a decimal(35,10), b int);
      insert into t(a,b) values(1,1);
      insert into t(a,b) values(2,1);
      insert into t(a,b) values(0,1);
      select * from t;
      a	b
      1.0000000000	1
      2.0000000000	1
      0.0000000000	1
      select sum(t.a) over (partition by t.b) as s1, sum(t.a) over (partition by t.b) + 1 as s2
      from t;
      s1	s2
      3.0000000000	1.0000000000
      3.0000000000	1.0000000000
      3.0000000000	1.0000000000
      

      s2 should be s1 + 1, not the constant 1

      Attachments

        Issue Links

          Activity

            cvicentiu Vicențiu Ciorbaru added a comment - CC: sanja igor psergey elenst

            Hi Sergey,

            Can you please review the patch for this MDEV? This does not fix MDEV-10669. I suspect there is a bit more work to be done wrt split_sum_func for the case operator.
            Link to commit:
            http://lists.askmonty.org/pipermail/commits/2016-September/009865.html

            cvicentiu Vicențiu Ciorbaru added a comment - Hi Sergey, Can you please review the patch for this MDEV? This does not fix MDEV-10669 . I suspect there is a bit more work to be done wrt split_sum_func for the case operator. Link to commit: http://lists.askmonty.org/pipermail/commits/2016-September/009865.html

            Sergey,
            I think this should be closed .

            igor Igor Babaev (Inactive) added a comment - Sergey, I think this should be closed .

            Works ok in the current branch. Fixed at least since MariaDB 10.2.10 (likely earlier, but I can build to check)

            psergei Sergei Petrunia added a comment - Works ok in the current branch. Fixed at least since MariaDB 10.2.10 (likely earlier, but I can build to check)

            People

              psergei Sergei Petrunia
              cvicentiu Vicențiu Ciorbaru
              Votes:
              0 Vote for this issue
              Watchers:
              4 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.