1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-07-29 08:21:15 +03:00

fix(plugin): Same columns fom different views in GROUP BY do not produce errors (#3035)

Fixes MCOL-5643.

The problem was that different views with same column names in GROUP BY
and on the SELECT clause produced an error about "projection column is
not an aggergate neither in GROUP BY list."

This was due to incorrect search in expressions's list that lead to
duplicate columns in GROUP BY list.
This commit is contained in:
Sergey Zefirov
2023-11-28 17:30:56 +03:00
committed by GitHub
parent 76e4e13b80
commit 9a84aa8d99
3 changed files with 77 additions and 7 deletions

View File

@ -0,0 +1,26 @@
drop database if exists MCOL_5643;
create database MCOL_5643;
use MCOL_5643;
create table t1
(
id int,
someStr varchar(100)
) ENGINE=Columnstore;
create table t2
(
id int,
fk_t1 int,
someStr varchar(100)
) ENGINE=Columnstore;
insert into t1 values (1, 'bla');
insert into t2 values (1, 1, 'xyz');
create view view_on_t1 as select id, someStr from t1;
create view view_on_t2 as select id, fk_t1, someStr from t2;
select max(view_on_t1.id), view_on_t1.someStr, view_on_t2.someStr
from view_on_t1
left outer join view_on_t2
on view_on_t1.id = view_on_t2.fk_t1
group by view_on_t1.someStr, view_on_t2.someStr;
max(view_on_t1.id) someStr someStr
1 bla xyz
drop database MCOL_5643;

View File

@ -0,0 +1,36 @@
--disable_warnings
drop database if exists MCOL_5643;
--enable_warnings
create database MCOL_5643;
use MCOL_5643;
create table t1
(
id int,
someStr varchar(100)
) ENGINE=Columnstore;
create table t2
(
id int,
fk_t1 int,
someStr varchar(100)
) ENGINE=Columnstore;
insert into t1 values (1, 'bla');
insert into t2 values (1, 1, 'xyz');
create view view_on_t1 as select id, someStr from t1;
create view view_on_t2 as select id, fk_t1, someStr from t2;
# ERROR !!!
select max(view_on_t1.id), view_on_t1.someStr, view_on_t2.someStr
from view_on_t1
left outer join view_on_t2
on view_on_t1.id = view_on_t2.fk_t1
group by view_on_t1.someStr, view_on_t2.someStr;
# ==> All non-aggregate columns in the SELECT and ORDER BY clause must be included in the GROUP BY clause. 0.063 sec
drop database MCOL_5643;