1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-08 11:22:35 +03:00

Merge 10.8 into 10.9

This commit is contained in:
Marko Mäkelä
2023-03-06 13:38:16 +02:00
21 changed files with 174 additions and 101 deletions

View File

@@ -3541,7 +3541,8 @@ bool JOIN::make_aggr_tables_info()
if (gbh)
{
if (!(pushdown_query= new (thd->mem_root) Pushdown_query(select_lex, gbh)))
if (!(pushdown_query= new (thd->mem_root) Pushdown_query(select_lex,
gbh)))
DBUG_RETURN(1);
/*
We must store rows in the tmp table if we need to do an ORDER BY
@@ -3561,6 +3562,7 @@ bool JOIN::make_aggr_tables_info()
if (!(curr_tab->tmp_table_param= new TMP_TABLE_PARAM(tmp_table_param)))
DBUG_RETURN(1);
curr_tab->tmp_table_param->func_count= all_fields.elements;
TABLE* table= create_tmp_table(thd, curr_tab->tmp_table_param,
all_fields,
NULL, distinct,
@@ -19150,6 +19152,7 @@ TABLE *Create_tmp_table::start(THD *thd,
*/
if (param->precomputed_group_by)
copy_func_count+= param->sum_func_count;
param->copy_func_count= copy_func_count;
init_sql_alloc(key_memory_TABLE, &own_root, TABLE_ALLOC_BLOCK_SIZE, 0,
MYF(MY_THREAD_SPECIFIC));
@@ -19355,8 +19358,9 @@ bool Create_tmp_table::add_fields(THD *thd,
We here distinguish between UNION and multi-table-updates by the fact
that in the later case group is set to the row pointer.
The test for item->marker == 4 is ensure we don't create a group-by
key over a bit field as heap tables can't handle that.
The test for item->marker == MARKER_NULL_KEY is ensure we
don't create a group-by key over a bit field as heap tables
can't handle that.
*/
DBUG_ASSERT(!param->schema_table);
Field *new_field=
@@ -19423,6 +19427,7 @@ bool Create_tmp_table::add_fields(THD *thd,
new_field->flags|= FIELD_PART_OF_TMP_UNIQUE;
}
}
DBUG_ASSERT(fieldnr == m_field_count[other] + m_field_count[distinct]);
DBUG_ASSERT(m_blob_count == m_blobs_count[other] + m_blobs_count[distinct]);
share->fields= fieldnr;
@@ -19431,6 +19436,8 @@ bool Create_tmp_table::add_fields(THD *thd,
share->blob_field[m_blob_count]= 0; // End marker
copy_func[0]= 0; // End marker
param->func_count= (uint) (copy_func - param->items_to_copy);
DBUG_ASSERT(param->func_count <= param->copy_func_count);
share->column_bitmap_size= bitmap_buffer_size(share->fields);
thd->mem_root= mem_root_save;
@@ -26887,6 +26894,11 @@ bool JOIN::rollup_init()
Item **ref_array;
tmp_table_param.quick_group= 0; // Can't create groups in tmp table
/*
Each group can potentially be replaced with Item_func_rollup_const() which
needs a copy_func placeholder.
*/
tmp_table_param.func_count+= send_group_parts;
rollup.state= ROLLUP::STATE_INITED;
/*
@@ -26911,7 +26923,6 @@ bool JOIN::rollup_init()
ref_array= (Item**) (rollup.ref_pointer_arrays+send_group_parts);
/*
Prepare space for field list for the different levels
These will be filled up in rollup_make_fields()
@@ -27075,7 +27086,6 @@ bool JOIN::rollup_make_fields(List<Item> &fields_arg, List<Item> &sel_fields,
/* Point to first hidden field */
uint ref_array_ix= fields_arg.elements-1;
/* Remember where the sum functions ends for the previous level */
sum_funcs_end[pos+1]= *func;