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

Union ALL with wrapped selects -Groub BY -syntax err

    XMLWordPrintable

Details

    Description

      A client is having issues with wrapped selects and UNION ALL. I'll attach their original DDL and query, but I have a simplified reproduction case here.

      # DDL & Data
      create table t2 ( a int, c varchar(50)) engine=columnstore;
      insert into t2 values (1, 'CT_PropDelay');
       
      # Query
      SELECT * FROM ( select a, c from t2 where c in ('x') group by a, c ) t
      UNION ALL
      SELECT * FROM ( select a, c from t2 where c in ('CT_PropDelay') group by a, c ) t
      

      • What happens today is an error is thrown:

        ERROR 1815 (HY000): Internal error: IDB-2021: 'c' is not in GROUP BY clause. All non-aggregate columns in the SELECT and ORDER BY clause must be included in the GROUP BY clause.
        

      • The expected outcome is for the query to run - with sample data it would look the same as

        +------+--------------+
        | a    | c            |
        +------+--------------+
        |    1 | CT_PropDelay |
        +------+--------------+
        1 rows in set (0.080 sec)
        

      Attachments

        1. OriginalDDL.sql
          0.4 kB
          Allen Herrera
        2. OriginalQuery.sql
          5 kB
          Allen Herrera

        Issue Links

          Activity

            People

              tntnatbry Gagan Goel (Inactive)
              allen.herrera Allen Herrera
              Daniel Lee Daniel Lee (Inactive)
              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.