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

DAY function returns wrong result in query on Columnstore table

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Critical
    • Resolution: Fixed
    • 23.02.2
    • 23.10.3
    • None
    • None
    • 2024-1

    Description

      Easy to reproduce:

      -- COLUMNSTORE
      create table my_colstore_tab(`yyyymmdd` date DEFAULT NULL) engine=COLUMNSTORE;
      insert into my_colstore_tab values(date(now()));
      insert into my_colstore_tab values(date(now()-interval 1 year));
       
      select day(s.yyyymmdd) as OK_1, last_day(s.yyyymmdd) as OK_2, day(last_day(s.yyyymmdd)) as NOT_OK from my_colstore_tab s;
      +------+------------+--------+
      | OK_1 | OK_2       | NOT_OK |
      +------+------------+--------+
      |   21 | 2024-02-29 |      0 |
      |   21 | 2023-02-28 |      0 |
      +------+------------+--------+
       
       
      -- INNODB
      create table my_innodb_tab(`yyyymmdd` date DEFAULT NULL) engine=INNODB;
      insert into my_innodb_tab values(date(now()));
      insert into my_innodb_tab values(date(now()-interval 1 year));
       
      select day(s.yyyymmdd) as OK_1, last_day(s.yyyymmdd) as OK_2, day(last_day(s.yyyymmdd)) as OK_3 from my_innodb_tab s;
      +------+------------+------+
      | OK_1 | OK_2       | OK_3 |
      +------+------------+------+
      |   21 | 2024-02-29 |   29 |
      |   21 | 2023-02-28 |   28 |
      +------+------------+------+
      
      

      Attachments

        Activity

          People

            sergey.zefirov Sergey Zefirov
            edward Edward Stoever
            Votes:
            1 Vote for this issue
            Watchers:
            6 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.