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

GROUP BY requires ORDER BY...

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Minor
    • Resolution: Won't Do
    • 1.1.2
    • Icebox
    • N/A
    • None
    • Ubuntu 16.04.3 LTS (GNU/Linux 4.4.0-1049-aws x86_64)

    Description

      Running a query with GROUP BY does not sort by grouped by column. Adding ASC or DESC does not affect the order. Repeating the query may produces results in different sequence particularly if the date range is expanded. Easy work around by adding an ORDER BY so I marked this as minor.

      -- version                  10.2.10-MariaDB-log         
      -- version_comment          Columnstore 1.1.2-1         
       
      CREATE TABLE `cs1` (
        `id` INT(10) UNSIGNED NOT NULL ,
        `timestamp_` DATETIME NOT NULL ,
        `numeric_val` DOUBLE DEFAULT NULL,
        `raw_val` DOUBLE DEFAULT NULL,
        `string_val` VARCHAR(3) DEFAULT NULL,
        `bitflags` SMALLINT(5) UNSIGNED NOT NULL DEFAULT 0 
      ) ENGINE=Columnstore DEFAULT CHARSET=latin1;
       
      SELECT DAY(timestamp_) as `Day`,SUM(numeric_val) AS Total, AVG(numeric_val) AS Average 
          FROM cs1
          WHERE timestamp_ >= '2017-09-01 00:00:00' AND timestamp_ < '2017-09-08 00:00:00'
            AND id IN (228091,228231,228233,227867,228216,228241)
          GROUP BY DAY(timestamp_);
      +------+--------------------+--------------------+
      | Day  | Total              | Average            |
      +------+--------------------+--------------------+
      |    2 |  52866.02035699998 |  157.8090159910447 |
      |    4 | 102331.42581999997 | 304.55781494047613 |
      |    7 |  41462.75725900001 | 123.40106327083338 |
      |    5 |  59282.80332899997 |  176.4369146696428 |
      |    1 |  65330.15804799998 |  195.0153971582089 |
      |    6 |  41260.32251999997 | 123.90487243243236 |
      |    3 |  87296.08161299997 | 259.80976670535705 |
      +------+--------------------+--------------------+
       
      
      

      Attachments

        Activity

          People

            Unassigned Unassigned
            thebreadguru MIke Thibodeau
            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.