From 457f3b99413e50c7cf393b06a86483e1854d86c8 Mon Sep 17 00:00:00 2001 From: Igor Babaev Date: Fri, 23 Sep 2016 14:42:12 -0700 Subject: [PATCH] Added the test case for bug mdev-9941 that was fixed some time ago. --- mysql-test/r/win.result | 43 +++++++++++++++++++++++++++++++++++++++++ mysql-test/t/win.test | 27 ++++++++++++++++++++++++++ 2 files changed, 70 insertions(+) diff --git a/mysql-test/r/win.result b/mysql-test/r/win.result index 4d9c58cc851..233308cd031 100644 --- a/mysql-test/r/win.result +++ b/mysql-test/r/win.result @@ -2142,3 +2142,46 @@ pk a d sum_1 sum_2 10 2 0.800 1.700 2.400 11 2 0.900 0.900 2.800 drop table t1; +# +# MDEV-9941: two window functions with compatible partitions +# +create table t1 ( +a int, +b int, +c int +); +insert into t1 values +(10, 1, 1), +(10, 3, 10), +(10, 1, 10), +(10, 3, 100), +(10, 5, 1000), +(10, 1, 100); +explain format=json +select +a,b,c, +row_number() over (partition by a), +row_number() over (partition by a, b) +from t1; +EXPLAIN +{ + "query_block": { + "select_id": 1, + "window_functions_computation": { + "sorts": { + "filesort": { + "sort_key": "t1.a, t1.b" + } + }, + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 6, + "filtered": 100 + } + } + } + } +} +drop table t1; diff --git a/mysql-test/t/win.test b/mysql-test/t/win.test index 10c673ac1b3..60bd42e026a 100644 --- a/mysql-test/t/win.test +++ b/mysql-test/t/win.test @@ -1310,3 +1310,30 @@ select pk, a, d, from t1; drop table t1; + +--echo # +--echo # MDEV-9941: two window functions with compatible partitions +--echo # + +create table t1 ( + a int, + b int, + c int +); + +insert into t1 values + (10, 1, 1), + (10, 3, 10), + (10, 1, 10), + (10, 3, 100), + (10, 5, 1000), + (10, 1, 100); + +explain format=json +select + a,b,c, + row_number() over (partition by a), + row_number() over (partition by a, b) +from t1; + +drop table t1;