Skip to content

Commit 3c15b14

Browse files
kahatlendahlerlend
authored andcommitted
Bug#36076513: Refactor LEX to use getter/setter instead of public member
Add a getter and a setter to better encapsulate LEX::using_hypergraph_optimizer. Change-Id: I56467ccedbe929fa18961cc37d7990febd77bdc9
1 parent 649c132 commit 3c15b14

31 files changed

+80
-58
lines changed

sql/item.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5635,7 +5635,7 @@ bool is_null_on_empty_table(THD *thd, Item_field *i) {
56355635
qsl->group_list.elements == 0;
56365636
else
56375637
return (sl->resolve_place == Query_block::RESOLVE_SELECT_LIST ||
5638-
(thd->lex->using_hypergraph_optimizer && sl->is_ordered())) &&
5638+
(thd->lex->using_hypergraph_optimizer() && sl->is_ordered())) &&
56395639
sl->with_sum_func && sl->group_list.elements == 0 &&
56405640
thd->lex->in_sum_func == nullptr;
56415641
}

sql/item_subselect.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -524,7 +524,7 @@ AccessPath *Item_in_subselect::root_access_path() const {
524524
// the query to the log for debugging, it isn't fully optimized
525525
// yet and might not yet have an iterator. Thus, return nullptr instead of
526526
// assert-failing.
527-
assert(current_thd->lex->using_hypergraph_optimizer);
527+
assert(current_thd->lex->using_hypergraph_optimizer());
528528
return nullptr;
529529
}
530530
}

sql/item_sum.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4779,7 +4779,7 @@ void Item_rank::update_after_wf_arguments_changed(THD *thd) {
47794779
// on them. This is called only during resolving with ROLLUP in case
47804780
// of old optimizer.
47814781
Item **item_to_be_changed;
4782-
if (!thd->lex->using_hypergraph_optimizer) {
4782+
if (!thd->lex->using_hypergraph_optimizer()) {
47834783
Item_ref *item_ref = down_cast<Item_ref *>(m_previous[i]->get_item());
47844784
item_to_be_changed = item_ref->ref_pointer();
47854785
} else {

sql/iterators/composite_iterators.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ bool AggregateIterator::Init() {
219219
// This is a hack. It would be good to get rid of the slice system altogether
220220
// (the hypergraph join optimizer does not use it).
221221
if (!(m_join->implicit_grouping || m_join->group_optimized_away) &&
222-
!thd()->lex->using_hypergraph_optimizer) {
222+
!thd()->lex->using_hypergraph_optimizer()) {
223223
m_output_slice = m_join->get_ref_item_slice();
224224
}
225225

sql/iterators/ref_row_iterators.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -607,7 +607,7 @@ FullTextSearchIterator::FullTextSearchIterator(THD *thd, TABLE *table,
607607
// hand, maintains alternative plans with and without index scans throughout
608608
// the planning, and doesn't determine whether it should use the indexed or
609609
// non-indexed plan until the full query plan has been constructed.
610-
if (thd->lex->using_hypergraph_optimizer) {
610+
if (thd->lex->using_hypergraph_optimizer()) {
611611
// Should not already be enabled.
612612
assert(!ft_func->score_from_index_scan);
613613
// Should operate on the main object.

sql/join_optimizer/access_path.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -810,7 +810,7 @@ unique_ptr_destroy_only<RowIterator> CreateIteratorFromAccessPath(
810810
// path instead of being computed here? We do make the same checks in
811811
// the cost model, so perhaps it should set the flag as well.
812812
uint64_t *hash_table_generation =
813-
(thd->lex->using_hypergraph_optimizer &&
813+
(thd->lex->using_hypergraph_optimizer() &&
814814
path->parameter_tables == 0)
815815
? &join->hash_table_generation
816816
: nullptr;

sql/mysqld.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4955,6 +4955,7 @@ int init_common_variables() {
49554955
}
49564956
}
49574957
update_parser_max_mem_size();
4958+
update_optimizer_switch();
49584959

49594960
if (set_default_auth_plugin(default_auth_plugin,
49604961
strlen(default_auth_plugin))) {

sql/opt_explain.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1911,7 +1911,7 @@ bool explain_single_table_modification(THD *explain_thd, const THD *query_thd,
19111911
return ExplainIterator(explain_thd, query_thd, nullptr);
19121912
}
19131913

1914-
if (query_thd->lex->using_hypergraph_optimizer) {
1914+
if (query_thd->lex->using_hypergraph_optimizer()) {
19151915
my_error(ER_HYPERGRAPH_NOT_SUPPORTED_YET, MYF(0),
19161916
"EXPLAIN with TRADITIONAL format");
19171917
return true;
@@ -2267,10 +2267,10 @@ bool explain_query(THD *explain_thd, const THD *query_thd,
22672267
// offloaded to a secondary engine, so we return a fake plan with that
22682268
// information.
22692269
const bool fake_explain_for_secondary_engine =
2270-
query_thd->lex->using_hypergraph_optimizer && secondary_engine &&
2270+
query_thd->lex->using_hypergraph_optimizer() && secondary_engine &&
22712271
!lex->explain_format->is_hierarchical();
22722272

2273-
if (query_thd->lex->using_hypergraph_optimizer &&
2273+
if (query_thd->lex->using_hypergraph_optimizer() &&
22742274
!fake_explain_for_secondary_engine) {
22752275
// With hypergraph, JSON is iterator-based. So it must be TRADITIONAL.
22762276
my_error(ER_HYPERGRAPH_NOT_SUPPORTED_YET, MYF(0),

sql/set_var.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1419,8 +1419,8 @@ int sql_set_variables(THD *thd, List<set_var_base> *var_list, bool opened) {
14191419
LEX *lex = thd->lex;
14201420
set_var_base *var;
14211421
if (!thd->lex->unit->is_prepared()) {
1422-
lex->using_hypergraph_optimizer =
1423-
thd->optimizer_switch_flag(OPTIMIZER_SWITCH_HYPERGRAPH_OPTIMIZER);
1422+
lex->set_using_hypergraph_optimizer(
1423+
thd->optimizer_switch_flag(OPTIMIZER_SWITCH_HYPERGRAPH_OPTIMIZER));
14241424

14251425
Prepared_stmt_arena_holder ps_arena_holder(thd);
14261426
while ((var = it++)) {

sql/set_var.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1110,7 +1110,6 @@ bool sql_mode_string_representation(THD *thd, sql_mode_t sql_mode,
11101110
LEX_STRING *ls);
11111111
bool sql_mode_quoted_string_representation(THD *thd, sql_mode_t sql_mode,
11121112
LEX_STRING *ls);
1113-
void update_parser_max_mem_size();
11141113

11151114
extern sys_var *Sys_autocommit_ptr;
11161115
extern sys_var *Sys_gtid_next_ptr;

0 commit comments

Comments
 (0)