You've already forked mariadb-columnstore-engine
mirror of
https://github.com/mariadb-corporation/mariadb-columnstore-engine.git
synced 2025-07-29 08:21:15 +03:00
MCOL-4719 iterate into subquery looking for windowfunctions
When an outer query filter accesses an subquery column that contains an aggregate or a window function, certain optimizations can't be performed. We had been looking at the surface of the returned column. We now iterate into any functions or operations looking for aggregates and window functions.
This commit is contained in:
17
mysql-test/columnstore/bugfixes/mcol_4719.result
Normal file
17
mysql-test/columnstore/bugfixes/mcol_4719.result
Normal file
@ -0,0 +1,17 @@
|
||||
DROP DATABASE IF EXISTS mcol_4719;
|
||||
CREATE DATABASE mcol_4719;
|
||||
USE mcol_4719;
|
||||
CREATE TABLE test_table (category CHAR(1), count INTEGER(1))ENGINE=COLUMNSTORE;
|
||||
INSERT INTO test_table (category, count) VALUES ('A', 1);
|
||||
INSERT INTO test_table (category, count) VALUES ('A', 2);
|
||||
INSERT INTO test_table (category, count) VALUES ('B', 3);
|
||||
INSERT INTO test_table (category, count) VALUES ('B', 4);
|
||||
select * FROM (SELECT count / SUM(count) OVER (PARTITION BY category) AS ratio FROM test_table) a where ratio > .5;
|
||||
ratio
|
||||
0.6667
|
||||
0.5714
|
||||
select * FROM (SELECT round(0+SUM(count) OVER (PARTITION BY category),3) AS x FROM test_table ) a where x>3;
|
||||
x
|
||||
7.000
|
||||
7.000
|
||||
DROP DATABASE mcol_4719;
|
17
mysql-test/columnstore/bugfixes/mcol_4719.test
Normal file
17
mysql-test/columnstore/bugfixes/mcol_4719.test
Normal file
@ -0,0 +1,17 @@
|
||||
--source ../include/have_columnstore.inc
|
||||
--disable_warnings
|
||||
DROP DATABASE IF EXISTS mcol_4719;
|
||||
--enable_warnings
|
||||
CREATE DATABASE mcol_4719;
|
||||
USE mcol_4719;
|
||||
CREATE TABLE test_table (category CHAR(1), count INTEGER(1))ENGINE=COLUMNSTORE;
|
||||
INSERT INTO test_table (category, count) VALUES ('A', 1);
|
||||
INSERT INTO test_table (category, count) VALUES ('A', 2);
|
||||
INSERT INTO test_table (category, count) VALUES ('B', 3);
|
||||
INSERT INTO test_table (category, count) VALUES ('B', 4);
|
||||
|
||||
# a subselect with an arithmetic operator on a window function
|
||||
select * FROM (SELECT count / SUM(count) OVER (PARTITION BY category) AS ratio FROM test_table) a where ratio > .5;
|
||||
# a subselect with a function containing an arithmetic operator on a window function
|
||||
select * FROM (SELECT round(0+SUM(count) OVER (PARTITION BY category),3) AS x FROM test_table ) a where x>3;
|
||||
DROP DATABASE mcol_4719;
|
Reference in New Issue
Block a user