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

ORDER BY no longer working in some queries

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Critical
    • Resolution: Fixed
    • 1.2.5
    • 1.4.4
    • ?
    • None
    • debian 9
    • 2020-3, 2020-4, 2020-5

    Description

      bug not present in 1.1.7 and definitely present in 1.2.5

      order by is not correctly processed for trivial queries

      let's say we want to compute sales for region 'x' and 'y', for each of 3 business units 1,2 and 3 like this:

      bu x y
      1 10 12
      2 11 11
      3 12 10

      when applying an order by clause, 'order by bu' or 'order by x' work but 'order by y' is ignored

      drop table if exists t;
      create table t(a int, b varchar(10), c decimal(7,2)) engine=columnstore;
      insert into t(a,b,c) values 
      (1,'x',10),(2,'x',11), (3, 'x', 12),
      (1,'y',12),(2,'y',11), (3, 'y', 10);
       
      -- order by column bu or x work fine
      select
      a as bu, 
      sum(case when b='x' then c else null end) as 'x',
      sum(case when b='y' then c else null end) as 'y'
      from t
      group by bu
      order by bu  /* or order by x */
      ;
       
      -- order by column y produces a random ordering of rows
      select
      a as bu, 
      sum(case when b='x' then c else null end) as 'x',
      sum(case when b='y' then c else null end) as 'y'
      from t
      group by bu
      order by y asc
      ;
      

      Attachments

        Activity

          People

            dleeyh Daniel Lee (Inactive)
            alebacq antoine
            Votes:
            0 Vote for this issue
            Watchers:
            5 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.