Skip to content

Commit

Permalink
Bug #30473261: CONVERT THE INDEX SUBQUERY ENGINES INTO USING THE ITER…
Browse files Browse the repository at this point in the history
…ATOR EXECUTOR [patch 9/10, sorted_result]

Pre-patch: Add some more --sorted_result to with_recursive.inc.

Change-Id: I5d4bd7684c5a3f0cbb8965d4484bed220b35ba1d
  • Loading branch information
Steinar H. Gunderson committed Dec 20, 2019
1 parent 31bd903 commit 5a41fba
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 16 deletions.
9 changes: 9 additions & 0 deletions mysql-test/include/with_recursive.inc
Original file line number Diff line number Diff line change
Expand Up @@ -274,12 +274,14 @@ select * from qn;
--echo # Prove that a materialized QN is shared among all references:

flush status;
--sorted_result
with recursive qn as (
select 123 as a union all
select 1+a from qn where a<125)
select * from qn;
show status like "handler_write";
flush status;
--sorted_result
with recursive qn as (
select 123 as a union all
select 1+a from qn where a<125)
Expand All @@ -289,6 +291,7 @@ show status like 'Created_tmp%table%';

--echo # Also works if references are nested inside other query names:
flush status;
--sorted_result
with recursive inner_ as (
select 123 as a union all
select 1+a from inner_ where a<125),
Expand All @@ -297,6 +300,7 @@ select * from outer_, outer_ as outer1;
show status like "handler_write";

flush status;
--sorted_result
with recursive inner_ as (
select 123 as a union all
select 1+a from inner_ where a<125),
Expand All @@ -308,6 +312,7 @@ show status like "handler_write";

--echo # Even if the two query names are recursive:
flush status;
--sorted_result
with recursive inner_ as (
select 123 as a union all
select 1+a from inner_ where a<125),
Expand Down Expand Up @@ -866,6 +871,7 @@ select count(*), max(depth) from cte;
--echo # Can use cycle detection:
--sorted_result
with recursive cte as
(
select id, cast(id as char(200)) as path, 0 as is_cycle
Expand All @@ -878,6 +884,7 @@ with recursive cte as
select * from cte;
--echo # It is simpler with DISTINCT:
--sorted_result
with recursive cte as
(
select id from nodes where id=1
Expand All @@ -892,6 +899,7 @@ drop table nodes, arcs;
--echo # key to force hash field, to see if it switches to InnoDB.

--echo # Not too long key (500 bytes in latin1)
--sorted_result
with recursive cte as
(
select 1 as n,
Expand All @@ -906,6 +914,7 @@ select sum(n) from cte;
show status like 'Created_tmp_disk_tables';

--echo # Too long key (>3000 bytes in latin1)
--sorted_result
with recursive cte as
(
select 1 as n,
Expand Down
32 changes: 16 additions & 16 deletions mysql-test/r/with_recursive.result
Original file line number Diff line number Diff line change
Expand Up @@ -405,9 +405,12 @@ outer_ as
select a*2 from outer_ where a<1000)
select a from outer_;
a
1000
123
124
125
1968
1984
246
248
250
Expand All @@ -416,9 +419,6 @@ a
500
984
992
1000
1968
1984
show status like "handler_write";
Variable_name Value
Handler_write 17
Expand Down Expand Up @@ -1253,14 +1253,14 @@ where from_id=cte.id and is_cycle=0
select * from cte;
id path is_cycle
1 1 0
1 1,3,6,2,1 1
1 1,4,6,2,1 1
2 1,3,6,2 0
2 1,4,6,2 0
3 1,3 0
4 1,4 0
6 1,3,6 0
6 1,4,6 0
2 1,3,6,2 0
2 1,4,6,2 0
1 1,3,6,2,1 1
1 1,4,6,2,1 1
# It is simpler with DISTINCT:
with recursive cte as
(
Expand All @@ -1271,10 +1271,10 @@ select to_id from arcs, cte where from_id=cte.id
select * from cte;
id
1
2
3
4
6
2
drop table nodes, arcs;
# Hash field and MEMORY don't work together. Make long distinct
# key to force hash field, to see if it switches to InnoDB.
Expand Down Expand Up @@ -1755,9 +1755,12 @@ outer_ as
select a*2 from outer_ where a<1000)
select a from outer_;
a
1000
123
124
125
1968
1984
246
248
250
Expand All @@ -1766,9 +1769,6 @@ a
500
984
992
1000
1968
1984
show status like "handler_write";
Variable_name Value
Handler_write 17
Expand Down Expand Up @@ -2603,14 +2603,14 @@ where from_id=cte.id and is_cycle=0
select * from cte;
id path is_cycle
1 1 0
1 1,3,6,2,1 1
1 1,4,6,2,1 1
2 1,3,6,2 0
2 1,4,6,2 0
3 1,3 0
4 1,4 0
6 1,3,6 0
6 1,4,6 0
2 1,3,6,2 0
2 1,4,6,2 0
1 1,3,6,2,1 1
1 1,4,6,2,1 1
# It is simpler with DISTINCT:
with recursive cte as
(
Expand All @@ -2621,10 +2621,10 @@ select to_id from arcs, cte where from_id=cte.id
select * from cte;
id
1
2
3
4
6
2
drop table nodes, arcs;
# Hash field and MEMORY don't work together. Make long distinct
# key to force hash field, to see if it switches to InnoDB.
Expand Down

0 comments on commit 5a41fba

Please sign in to comment.