Commit 957809b1 authored by Sergei Petrunia's avatar Sergei Petrunia

MDEV-9922: Assertion `!join->only_const_tables() && fsort' failed

When join output is just one row, we still need to compute window
function values for it. We could skip invoking filesort for it,
but it doesn't seem to be worth it to do such optimization.
parent a81e711a
drop table if exists t1,t2; drop table if exists t1,t2;
drop view if exists v1;
# ######################################################################## # ########################################################################
# # Parser tests # # Parser tests
# ######################################################################## # ########################################################################
...@@ -1950,3 +1951,11 @@ i sum(i) over (partition by i) ...@@ -1950,3 +1951,11 @@ i sum(i) over (partition by i)
1 1 1 1
2 2 2 2
drop table t1; drop table t1;
#
# MDEV-9922: Assertion `!join->only_const_tables() && fsort' failed in int create_sort_index
#
create view v1 as select 1 as i;
select rank() over (order by i) from v1;
rank() over (order by i)
1
drop view v1;
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
--disable_warnings --disable_warnings
drop table if exists t1,t2; drop table if exists t1,t2;
drop view if exists v1;
--enable_warnings --enable_warnings
--echo # ######################################################################## --echo # ########################################################################
...@@ -1193,3 +1194,10 @@ insert into t1 values (1),(2); ...@@ -1193,3 +1194,10 @@ insert into t1 values (1),(2);
select i, sum(i) over (partition by i) from t1; select i, sum(i) over (partition by i) from t1;
drop table t1; drop table t1;
--echo #
--echo # MDEV-9922: Assertion `!join->only_const_tables() && fsort' failed in int create_sort_index
--echo #
create view v1 as select 1 as i;
select rank() over (order by i) from v1;
drop view v1;
...@@ -21221,8 +21221,6 @@ create_sort_index(THD *thd, JOIN *join, JOIN_TAB *tab, Filesort *fsort) ...@@ -21221,8 +21221,6 @@ create_sort_index(THD *thd, JOIN *join, JOIN_TAB *tab, Filesort *fsort)
if (fsort == NULL) if (fsort == NULL)
fsort= tab->filesort; fsort= tab->filesort;
// One row, no need to sort. make_tmp_tables_info should already handle this.
DBUG_ASSERT(!join->only_const_tables() && fsort);
table= tab->table; table= tab->table;
select= fsort->select; select= fsort->select;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment