Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
1ee02f2c
Commit
1ee02f2c
authored
Feb 17, 2020
by
Varun Gupta
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixing sort_nest.test
parent
f221f10a
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
484 additions
and
1293 deletions
+484
-1293
mysql-test/main/sort_nest.result
mysql-test/main/sort_nest.result
+420
-984
mysql-test/main/sort_nest.test
mysql-test/main/sort_nest.test
+64
-210
mysql-test/main/sort_nest_subselect.test
mysql-test/main/sort_nest_subselect.test
+0
-99
No files found.
mysql-test/main/sort_nest.result
View file @
1ee02f2c
This diff is collapsed.
Click to expand it.
mysql-test/main/sort_nest.test
View file @
1ee02f2c
This diff is collapsed.
Click to expand it.
mysql-test/main/sort_nest_subselect.test
deleted
100644 → 0
View file @
f221f10a
--
echo
#
--
echo
# Testing SORT-NEST with non-flattened Subqueries
--
echo
#
--
echo
#
--
echo
# Dependent subquery attached to table t3 outside the sort-nest(t1,t2)
--
echo
#
set
use_sort_nest
=
1
;
create
table
t0
(
a
int
);
insert
into
t0
values
(
0
),(
1
),(
2
),(
3
),(
4
),(
5
),(
6
),(
7
),(
8
),(
9
);
create
table
t1
(
a
int
,
b
int
);
insert
into
t1
select
a
,
a
from
t0
where
a
<
5
;
# 5 rows
create
table
t2
as
select
*
from
t1
where
a
<
5
;
# 5 rows
create
table
t3
(
a
int
,
b
int
,
c
int
);
insert
into
t3
select
A
.
a
+
10
*
B
.
a
,
A
.
a
+
10
*
B
.
a
,
A
.
a
+
10
*
B
.
a
from
t0
A
,
t0
B
;
# 100 rows
create
table
t4
(
a
int
,
b
int
,
c
int
,
key
(
b
));
insert
into
t4
select
A
.
a
+
10
*
B
.
a
,
A
.
a
+
10
*
B
.
a
,
A
.
a
+
10
*
B
.
a
from
t0
A
,
t0
B
;
# 100 rows
--
echo
# ref access inside the dependent subquery should be with sort-nest.b instead of t1.b
--
echo
# subquery is attached to table t3 which is outside the sort-nest
let
$query
=
SELECT
*
FROM
t1
,
t2
,
t3
WHERE
t1
.
b
=
t2
.
b
and
EXISTS
(
select
1
from
t4
where
t4
.
b
=
t1
.
b
and
t4
.
b
<
4
group
by
t4
.
c
having
t3
.
b
=
max
(
t4
.
a
))
ORDER
BY
t2
.
a
desc
,
t1
.
a
desc
LIMIT
5
;
eval
EXPLAIN
$query
;
eval
EXPLAIN
FORMAT
=
JSON
$query
;
eval
$query
;
--
echo
# same as above but exists to in transformation not allowed
--
echo
# subquery is attached to table t3 which is outside the sort-nest
set
optimizer_switch
=
'exists_to_in=off'
;
eval
EXPLAIN
$query
;
eval
EXPLAIN
FORMAT
=
JSON
$query
;
eval
$query
;
set
optimizer_switch
=
default
;
drop
table
t0
,
t1
,
t2
,
t3
,
t4
;
--
echo
# DEPENDENT SUBQUERIES
create
table
t0
(
a
int
);
insert
into
t0
values
(
0
),(
1
),(
2
),(
3
),(
4
),(
5
),(
6
),(
7
),(
8
),(
9
);
create
table
t1
(
a
int
,
b
int
);
insert
into
t1
select
a
,
a
from
t0
where
a
<
5
;
create
table
t2
as
select
*
from
t1
where
a
<
5
;
create
table
t3
as
select
(
A
.
a
+
10
*
B
.
a
+
C
.
a
*
100
)
as
a
,
(
A
.
a
+
10
*
B
.
a
+
C
.
a
*
100
)
as
b
,
(
A
.
a
+
10
*
B
.
a
+
C
.
a
*
100
)
as
c
from
t0
A
,
t0
B
,
t0
C
;
# 1000 rows
set
optimizer_switch
=
'exists_to_in=off'
;
--
echo
# sort-nest(t2,t1) and subquery should be attached to table ot1
let
$query
=
select
*
from
t2
,
t1
,
t3
where
exists
(
select
max
(
t3
.
a
)
from
t3
t4
where
t4
.
b
=
t1
.
b
group
by
t4
.
c
having
t3
.
a
=
max
(
t4
.
a
))
order
by
t2
.
a
desc
,
t1
.
a
desc
limit
5
;
eval
explain
$query
;
eval
explain
format
=
json
$query
;
eval
$query
;
set
optimizer_switch
=
default
;
--
echo
# sort-nest(t2,t1) and subquery should be attached to table ot1 (same as above)
let
$query
=
select
*
from
t2
,
t1
,
t3
where
t3
.
a
in
(
select
max
(
t4
.
a
)
from
t3
t4
where
t4
.
b
=
t1
.
b
group
by
t4
.
c
)
order
by
t2
.
a
desc
,
t1
.
a
desc
limit
5
;
eval
explain
$query
;
eval
explain
format
=
json
$query
;
eval
$query
;
--
echo
# sort-nest(t2,t1) and dependent subquery in the select list
let
$query
=
select
(
select
t4
.
a
from
t3
t4
where
t4
.
a
>
t1
.
b
limit
1
)
as
x
,
t2
.
b
,
t1
.
b
,
t3
.
a
from
t1
,
t2
,
t3
where
t1
.
a
=
t2
.
a
order
by
t2
.
b
desc
,
t1
.
b
desc
limit
5
;
eval
explain
$query
;
eval
explain
format
=
json
$query
;
eval
$query
;
--
echo
#
--
echo
# sort-nest(t2,t1) and sort-nest fields substitution in the having clause of the subquery
--
echo
# after IN -> EXISTS transformation
--
echo
#
let
$query
=
select
*
from
t2
,
t1
,
t3
ot1
where
t2
.
a
+
ot1
.
a
in
(
select
max
(
t3
.
a
)
from
t3
where
t3
.
b
=
t1
.
b
group
by
t3
.
c
)
order
by
t2
.
a
desc
,
t1
.
a
desc
limit
5
;
eval
explain
$query
;
eval
explain
format
=
json
$query
;
eval
$query
;
drop
table
t0
,
t1
,
t2
,
t3
;
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment