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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
15120713
Commit
15120713
authored
Apr 05, 2011
by
Sergey Petrunya
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MWL#90: Address review feedback part #18
parent
409902f8
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
28 deletions
+14
-28
sql/item_subselect.h
sql/item_subselect.h
+12
-6
sql/opt_subselect.cc
sql/opt_subselect.cc
+2
-22
No files found.
sql/item_subselect.h
View file @
15120713
...
...
@@ -371,12 +371,6 @@ public:
See also THD::emb_on_expr_nest.
*/
TABLE_LIST
*
emb_on_expr_nest
;
/*
Location of the subquery predicate. It is either
- pointer to join nest if the subquery predicate is in the ON expression
- (TABLE_LIST*)1 if the predicate is in the WHERE.
*/
//TABLE_LIST *expr_join_nest;
/*
Types of left_expr and subquery's select list allow to perform subquery
materialization. Currently, we set this to FALSE when it as well could
...
...
@@ -403,6 +397,18 @@ public:
*/
bool
is_flattenable_semijoin
;
/*
Used to determine how this subselect item is represented in the item tree,
in case there is a need to locate it there and replace with something else.
Two options are possible:
1. This item is there 'as-is'.
1. This item is wrapped within Item_in_optimizer.
*/
Item
*
original_item
()
{
return
is_flattenable_semijoin
?
(
Item
*
)
this
:
(
Item
*
)
optimizer
;
}
bool
*
get_cond_guard
(
int
i
)
{
return
pushed_cond_guards
?
pushed_cond_guards
+
i
:
NULL
;
...
...
sql/opt_subselect.cc
View file @
15120713
...
...
@@ -712,16 +712,7 @@ bool convert_join_subqueries_to_semijoins(JOIN *join)
{
Item
**
tree
=
((
*
in_subq
)
->
emb_on_expr_nest
==
NO_JOIN_NEST
)
?
&
join
->
conds
:
&
((
*
in_subq
)
->
emb_on_expr_nest
->
on_expr
);
Item
*
replace_me
=
*
in_subq
;
/*
JTBM: the subquery was already mapped with Item_in_optimizer, so we
should search for that, not for original Item_in_subselect.
TODO: what about delaying that rewrite until here?
*/
if
(
!
(
*
in_subq
)
->
is_flattenable_semijoin
)
{
replace_me
=
(
*
in_subq
)
->
optimizer
;
}
Item
*
replace_me
=
(
*
in_subq
)
->
original_item
();
if
(
replace_where_subcondition
(
join
,
tree
,
replace_me
,
new
Item_int
(
1
),
FALSE
))
DBUG_RETURN
(
TRUE
);
/* purecov: inspected */
...
...
@@ -756,18 +747,7 @@ skip_conversion:
bool
do_fix_fields
=
!
(
*
in_subq
)
->
substitution
->
fixed
;
Item
**
tree
=
((
*
in_subq
)
->
emb_on_expr_nest
==
NO_JOIN_NEST
)
?
&
join
->
conds
:
&
((
*
in_subq
)
->
emb_on_expr_nest
->
on_expr
);
Item
*
replace_me
=
*
in_subq
;
/*
JTBM: the subquery was already mapped with Item_in_optimizer, so we
should search for that, not for original Item_in_subselect.
TODO: what about delaying that rewrite until here?
*/
if
(
!
(
*
in_subq
)
->
is_flattenable_semijoin
)
{
replace_me
=
(
*
in_subq
)
->
optimizer
;
}
Item
*
replace_me
=
(
*
in_subq
)
->
original_item
();
if
(
replace_where_subcondition
(
join
,
tree
,
replace_me
,
substitute
,
do_fix_fields
))
DBUG_RETURN
(
TRUE
);
...
...
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