summaryrefslogtreecommitdiff
path: root/sql/sql_select.cc
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2023-02-16 10:25:34 +0200
committerMarko Mäkelä <marko.makela@mariadb.com>2023-02-16 10:25:34 +0200
commit0d55914d968fcc557d4429a37c61fbdedd9352a6 (patch)
treec119f75d1aac283025ff379b07cab78b6d8b384d /sql/sql_select.cc
parent37a46e21815fe1176d211a89283d9bc17fcd39db (diff)
parentb12cd88ce177b475066734b06c1e3a4445a62d86 (diff)
downloadmariadb-git-0d55914d968fcc557d4429a37c61fbdedd9352a6.tar.gz
Merge 10.8 into 10.9
Diffstat (limited to 'sql/sql_select.cc')
-rw-r--r--sql/sql_select.cc8
1 files changed, 3 insertions, 5 deletions
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index beb5ce5093a..55c222e4e63 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -4193,7 +4193,7 @@ JOIN::optimize_distinct()
}
/* Optimize "select distinct b from t1 order by key_part_1 limit #" */
- if (order && skip_sort_order)
+ if (order && skip_sort_order && !unit->lim.is_with_ties())
{
/* Should already have been optimized away */
DBUG_ASSERT(ordered_index_usage == ordered_index_order_by);
@@ -30124,7 +30124,6 @@ void JOIN::make_notnull_conds_for_range_scans()
{
DBUG_ENTER("JOIN::make_notnull_conds_for_range_scans");
-
if (impossible_where ||
!optimizer_flag(thd, OPTIMIZER_SWITCH_NOT_NULL_RANGE_SCAN))
{
@@ -30204,7 +30203,6 @@ bool build_notnull_conds_for_range_scans(JOIN *join, Item *cond,
table_map allowed)
{
THD *thd= join->thd;
-
DBUG_ENTER("build_notnull_conds_for_range_scans");
for (JOIN_TAB *s= join->join_tab;
@@ -30212,13 +30210,13 @@ bool build_notnull_conds_for_range_scans(JOIN *join, Item *cond,
{
/* Clear all needed bitmaps to mark found fields */
if ((allowed & s->table->map) &&
- !(s->table->map && join->const_table_map))
+ !(s->table->map & join->const_table_map))
bitmap_clear_all(&s->table->tmp_set);
}
/*
Find all null-rejected fields assuming that cond is null-rejected and
- only formulas over tables from 'allowed' are to be taken into account
+ only formulas over tables from 'allowed' are to be taken into account
*/
if (cond->find_not_null_fields(allowed))
DBUG_RETURN(true);