diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2021-03-27 18:03:03 +0200 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2021-03-27 18:03:03 +0200 |
commit | e538cb095f6290c40e8928e3813db6ac679740a2 (patch) | |
tree | 51f12fad5a2928fc1d398e7f45fc40c1c09e2512 /sql/sql_select.cc | |
parent | 356c149603285086d964c8a51107be97b981c15c (diff) | |
parent | 80459bcbd4ca2cfd149f58c41428882fcfc49e03 (diff) | |
download | mariadb-git-e538cb095f6290c40e8928e3813db6ac679740a2.tar.gz |
Merge 10.5 into 10.6
Diffstat (limited to 'sql/sql_select.cc')
-rw-r--r-- | sql/sql_select.cc | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 155c68545fc..794bc4d69ae 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -299,6 +299,8 @@ void set_postjoin_aggr_write_func(JOIN_TAB *tab); static Item **get_sargable_cond(JOIN *join, TABLE *table); +bool is_eq_cond_injected_for_split_opt(Item_func_eq *eq_item); + static bool build_notnull_conds_for_range_scans(JOIN *join, COND *cond, table_map allowed); @@ -22783,6 +22785,21 @@ make_cond_for_table_from_pred(THD *thd, Item *root_cond, Item *cond, cond->marker=3; // Checked when read return (COND*) 0; } + /* + If cond is an equality injected for split optimization then + a. when retain_ref_cond == false : cond is removed unconditionally + (cond that supports ref access is removed by the preceding code) + b. when retain_ref_cond == true : cond is removed if it does not + support ref access + */ + if (left_item->type() == Item::FIELD_ITEM && + is_eq_cond_injected_for_split_opt((Item_func_eq *) cond) && + (!retain_ref_cond || + !test_if_ref(root_cond, (Item_field*) left_item,right_item))) + { + cond->marker=3; + return (COND*) 0; + } } cond->marker=2; cond->set_join_tab_idx(join_tab_idx_arg); |