[MCOL-4937] Union ALL with wrapped selects -Groub BY -syntax err Created: 2021-12-06  Updated: 2023-11-17  Resolved: 2023-02-28

Status: Closed
Project: MariaDB ColumnStore
Component/s: None
Affects Version/s: 6.1.1
Fix Version/s: 23.02.1

Type: Bug Priority: Blocker
Reporter: Allen Herrera Assignee: Gagan Goel (Inactive)
Resolution: Fixed Votes: 0
Labels: mcs_rel_2302_1

Attachments: File OriginalDDL.sql     File OriginalQuery.sql    
Issue Links:
Relates
relates to MCOL-4942 Different results compared to innodb ... Open
Assigned for Testing: Daniel Lee Daniel Lee (Inactive)

 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)
    



 Comments   
Comment by Gagan Goel (Inactive) [ 2023-02-28 ]

For QA: Instructions for reproduction are in the ticket description. Please also confirm the attached SQL query runs without an error.

Comment by Daniel Lee (Inactive) [ 2023-02-28 ]

Build verified:
engine: 4d4e4ad30dd2ec494ea9d323e1fa7fa69e97243e
server: 1916028f898cf672a8b79d2b585b1d74f8bcd7db
buildNo: 6965

Verified all test case in the ticket.

Generated at Thu Feb 08 02:54:08 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.