Commit 4594d68d authored by Vladislav Vaintroub's avatar Vladislav Vaintroub

MDEV-19702 Refactor Bitmap<N> to be based on ulonglong, not on uint32

Removed Field_map, since it was used only in a single function.

Fixed is_indexed_agg_distinct(), since it relied on initialization of
Bitmap in constructor.
parent 3c88ce4c
This diff is collapsed.
......@@ -6889,7 +6889,6 @@ void optimize_keyuse(JOIN *join, DYNAMIC_ARRAY *keyuse_array)
}
}
/**
Check for the presence of AGGFN(DISTINCT a) queries that may be subject
to loose index scan.
......@@ -6927,7 +6926,6 @@ is_indexed_agg_distinct(JOIN *join, List<Item_field> *out_args)
{
Item_sum **sum_item_ptr;
bool result= false;
Field_map first_aggdistinct_fields;
if (join->table_count != 1 || /* reference more than 1 table */
join->select_distinct || /* or a DISTINCT */
......@@ -6937,10 +6935,11 @@ is_indexed_agg_distinct(JOIN *join, List<Item_field> *out_args)
if (join->make_sum_func_list(join->all_fields, join->fields_list, true))
return false;
Bitmap<MAX_FIELDS> first_aggdistinct_fields;
bool first_aggdistinct_fields_initialized= false;
for (sum_item_ptr= join->sum_funcs; *sum_item_ptr; sum_item_ptr++)
{
Item_sum *sum_item= *sum_item_ptr;
Field_map cur_aggdistinct_fields;
Item *expr;
/* aggregate is not AGGFN(DISTINCT) or more than 1 argument to it */
switch (sum_item->sum_func())
......@@ -6963,6 +6962,8 @@ is_indexed_agg_distinct(JOIN *join, List<Item_field> *out_args)
We don't worry about duplicates as these will be sorted out later in
get_best_group_min_max
*/
Bitmap<MAX_FIELDS> cur_aggdistinct_fields;
cur_aggdistinct_fields.clear_all();
for (uint i= 0; i < sum_item->get_arg_count(); i++)
{
expr= sum_item->get_arg(i);
......@@ -6981,8 +6982,11 @@ is_indexed_agg_distinct(JOIN *join, List<Item_field> *out_args)
If there are multiple aggregate functions, make sure that they all
refer to exactly the same set of columns.
*/
if (first_aggdistinct_fields.is_clear_all())
first_aggdistinct_fields.merge(cur_aggdistinct_fields);
if (!first_aggdistinct_fields_initialized)
{
first_aggdistinct_fields= cur_aggdistinct_fields;
first_aggdistinct_fields_initialized=true;
}
else if (first_aggdistinct_fields != cur_aggdistinct_fields)
return false;
}
......
......@@ -1094,9 +1094,6 @@ struct st_cond_statistic;
#define CHECK_ROW_FOR_NULLS_TO_REJECT (1 << 0)
#define REJECT_ROW_DUE_TO_NULL_FIELDS (1 << 1)
/* Bitmap of table's fields */
typedef Bitmap<MAX_FIELDS> Field_map;
class SplM_opt_info;
struct vers_select_conds_t;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment