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

incorrect lead window function value with null

    XMLWordPrintable

Details

    Description

      when you have a null in the value being windowed over this is being put at the end but the lead value is the first value in the window rather than null. I believe it should be null. If you don't have any nulls it behaves this way. This would also be a regression for columnstore 1.1.

      Steps to repro:

      create table t1(dt datetime);
      insert into t1 values ('2017-05-17'), ('2017-05-18'), (null);
       
      > select dt,lead(dt) over (order by dt) next from t1 where dt is not null;
      +---------------------+---------------------+
      | dt                  | next                |
      +---------------------+---------------------+
      | 2017-05-17 00:00:00 | 2017-05-18 00:00:00 |
      | 2017-05-18 00:00:00 | NULL                |
      +---------------------+---------------------+
      2 rows in set (0.00 sec)
       
      MariaDB [genesis]> select dt,lead(dt) over (order by dt) next from t1;
      +---------------------+---------------------+
      | dt                  | next                |
      +---------------------+---------------------+
      | 2017-05-17 00:00:00 | 2017-05-18 00:00:00 |
      | 2017-05-18 00:00:00 | NULL                |
      | NULL                | 2017-05-17 00:00:00 |
      +---------------------+---------------------+
      3 rows in set (0.00 sec)
       
      
      

      Attachments

        Activity

          People

            Unassigned Unassigned
            dthompson David Thompson (Inactive)
            Votes:
            0 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.