mirror of
https://github.com/MariaDB/server.git
synced 2025-07-27 18:02:13 +03:00
Merge 10.1 into 10.2
For MDEV-15955, the fix in create_tmp_field_from_item() would cause a compilation error. After a discussion with Alexander Barkov, the fix was omitted and only the test case was kept. In 10.3 and later, MDEV-15955 is fixed properly by overriding create_tmp_field() in Item_func_user_var.
This commit is contained in:
@ -7961,6 +7961,7 @@ double table_cond_selectivity(JOIN *join, uint idx, JOIN_TAB *s,
|
||||
KEYUSE *keyuse= pos->key;
|
||||
KEYUSE *prev_ref_keyuse= keyuse;
|
||||
uint key= keyuse->key;
|
||||
bool used_range_selectivity= false;
|
||||
|
||||
/*
|
||||
Check if we have a prefix of key=const that matches a quick select.
|
||||
@ -7986,6 +7987,7 @@ double table_cond_selectivity(JOIN *join, uint idx, JOIN_TAB *s,
|
||||
keyparts++;
|
||||
}
|
||||
sel /= (double)table->quick_rows[key] / (double) table->stat_records();
|
||||
used_range_selectivity= true;
|
||||
}
|
||||
}
|
||||
|
||||
@ -8021,13 +8023,14 @@ double table_cond_selectivity(JOIN *join, uint idx, JOIN_TAB *s,
|
||||
if (keyparts > keyuse->keypart)
|
||||
{
|
||||
/* Ok this is the keyuse that will be used for ref access */
|
||||
uint fldno;
|
||||
if (is_hash_join_key_no(key))
|
||||
fldno= keyuse->keypart;
|
||||
else
|
||||
fldno= table->key_info[key].key_part[keyparts-1].fieldnr - 1;
|
||||
if (keyuse->val->const_item())
|
||||
if (!used_range_selectivity && keyuse->val->const_item())
|
||||
{
|
||||
uint fldno;
|
||||
if (is_hash_join_key_no(key))
|
||||
fldno= keyuse->keypart;
|
||||
else
|
||||
fldno= table->key_info[key].key_part[keyparts-1].fieldnr - 1;
|
||||
|
||||
if (table->field[fldno]->cond_selectivity > 0)
|
||||
{
|
||||
sel /= table->field[fldno]->cond_selectivity;
|
||||
@ -16344,10 +16347,9 @@ Field *Item::create_tmp_field(bool group, TABLE *table, uint convert_int_length)
|
||||
static Field *create_tmp_field_from_item(THD *thd, Item *item, TABLE *table,
|
||||
Item ***copy_func, bool modify_item)
|
||||
{
|
||||
Field *UNINIT_VAR(new_field);
|
||||
DBUG_ASSERT(thd == table->in_use);
|
||||
new_field= item->Item::create_tmp_field(false, table);
|
||||
|
||||
Field *new_field= item->Item::create_tmp_field(false, table);
|
||||
|
||||
if (copy_func &&
|
||||
(item->is_result_field() ||
|
||||
(item->real_item()->is_result_field())))
|
||||
|
Reference in New Issue
Block a user