mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
Resolve merge colflict
This commit is contained in:
@ -868,12 +868,14 @@ JOIN::reinit()
|
||||
exec_tmp_table1->file->extra(HA_EXTRA_RESET_STATE);
|
||||
exec_tmp_table1->file->delete_all_rows();
|
||||
free_io_cache(exec_tmp_table1);
|
||||
filesort_free_buffers(exec_tmp_table1);
|
||||
}
|
||||
if (exec_tmp_table2)
|
||||
{
|
||||
exec_tmp_table2->file->extra(HA_EXTRA_RESET_STATE);
|
||||
exec_tmp_table2->file->delete_all_rows();
|
||||
free_io_cache(exec_tmp_table2);
|
||||
filesort_free_buffers(exec_tmp_table2);
|
||||
}
|
||||
if (items0)
|
||||
memcpy(ref_pointer_array, items0, ref_pointer_array_size);
|
||||
@ -2319,7 +2321,8 @@ find_best(JOIN *join,table_map rest_tables,uint idx,double record_count,
|
||||
we don't make rec less than 100.
|
||||
*/
|
||||
if (keyuse->used_tables &
|
||||
(map=(keyuse->used_tables & ~join->const_table_map)))
|
||||
(map=(keyuse->used_tables & ~join->const_table_map &
|
||||
~OUTER_REF_TABLE_BIT)))
|
||||
{
|
||||
uint tablenr;
|
||||
for (tablenr=0 ; ! (map & 1) ; map>>=1, tablenr++) ;
|
||||
@ -2631,7 +2634,7 @@ static double
|
||||
prev_record_reads(JOIN *join,table_map found_ref)
|
||||
{
|
||||
double found=1.0;
|
||||
|
||||
found_ref&= ~OUTER_REF_TABLE_BIT;
|
||||
for (POSITION *pos=join->positions ; found_ref ; pos++)
|
||||
{
|
||||
if (pos->table->table->map & found_ref)
|
||||
@ -2665,7 +2668,7 @@ get_best_combination(JOIN *join)
|
||||
|
||||
join->full_join=0;
|
||||
|
||||
used_tables=0;
|
||||
used_tables= OUTER_REF_TABLE_BIT; // Outer row is already read
|
||||
for (j=join_tab, tablenr=0 ; tablenr < table_count ; tablenr++,j++)
|
||||
{
|
||||
TABLE *form;
|
||||
@ -2936,7 +2939,8 @@ make_join_select(JOIN *join,SQL_SELECT *select,COND *cond)
|
||||
DBUG_RETURN(1); // Impossible const condition
|
||||
}
|
||||
}
|
||||
used_tables=(select->const_tables=join->const_table_map) | RAND_TABLE_BIT;
|
||||
used_tables=((select->const_tables=join->const_table_map) |
|
||||
OUTER_REF_TABLE_BIT | RAND_TABLE_BIT);
|
||||
for (uint i=join->const_tables ; i < join->tables ; i++)
|
||||
{
|
||||
JOIN_TAB *tab=join->join_tab+i;
|
||||
@ -2946,7 +2950,7 @@ make_join_select(JOIN *join,SQL_SELECT *select,COND *cond)
|
||||
It solve problem with select like SELECT * FROM t1 WHERE rand() > 0.5
|
||||
*/
|
||||
if (i == join->tables-1)
|
||||
current_map|= RAND_TABLE_BIT;
|
||||
current_map|= OUTER_REF_TABLE_BIT | RAND_TABLE_BIT;
|
||||
bool use_quick_range=0;
|
||||
used_tables|=current_map;
|
||||
|
||||
@ -3265,7 +3269,10 @@ join_free(JOIN *join, bool full)
|
||||
first non const table in join->table
|
||||
*/
|
||||
if (join->tables > join->const_tables) // Test for not-const tables
|
||||
{
|
||||
free_io_cache(join->table[join->const_tables]);
|
||||
filesort_free_buffers(join->table[join->const_tables]);
|
||||
}
|
||||
if (join->select_lex->dependent && !full)
|
||||
{
|
||||
for (tab=join->join_tab,end=tab+join->tables ; tab != end ; tab++)
|
||||
@ -3429,7 +3436,8 @@ static void update_depend_map(JOIN *join)
|
||||
uint i;
|
||||
for (i=0 ; i < ref->key_parts ; i++,item++)
|
||||
depend_map|=(*item)->used_tables();
|
||||
ref->depend_map=depend_map;
|
||||
ref->depend_map=depend_map & ~OUTER_REF_TABLE_BIT;
|
||||
depend_map&= ~OUTER_REF_TABLE_BIT;
|
||||
for (JOIN_TAB **tab=join->map2table;
|
||||
depend_map ;
|
||||
tab++,depend_map>>=1 )
|
||||
@ -3450,7 +3458,8 @@ static void update_depend_map(JOIN *join, ORDER *order)
|
||||
table_map depend_map;
|
||||
order->item[0]->update_used_tables();
|
||||
order->depend_map=depend_map=order->item[0]->used_tables();
|
||||
if (!(order->depend_map & RAND_TABLE_BIT)) // Not item_sum() or RAND()
|
||||
// Not item_sum(), RAND() and no reference to table outside of sub select
|
||||
if (!(order->depend_map & (OUTER_REF_TABLE_BIT | RAND_TABLE_BIT)))
|
||||
{
|
||||
for (JOIN_TAB **tab=join->map2table;
|
||||
depend_map ;
|
||||
@ -3497,7 +3506,7 @@ remove_const(JOIN *join,ORDER *first_order, COND *cond, bool *simple_order)
|
||||
}
|
||||
else
|
||||
{
|
||||
if (order_tables & RAND_TABLE_BIT)
|
||||
if (order_tables & (RAND_TABLE_BIT | OUTER_REF_TABLE_BIT))
|
||||
*simple_order=0;
|
||||
else
|
||||
{
|
||||
@ -4376,7 +4385,7 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List<Item> &fields,
|
||||
if (!(table->record[0]= (byte *) my_malloc(alloc_length*3, MYF(MY_WME))))
|
||||
goto err;
|
||||
table->record[1]= table->record[0]+alloc_length;
|
||||
table->record[2]= table->record[1]+alloc_length;
|
||||
table->default_values= table->record[1]+alloc_length;
|
||||
}
|
||||
copy_func[0]=0; // End marker
|
||||
|
||||
@ -4450,7 +4459,7 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List<Item> &fields,
|
||||
|
||||
param->copy_field_end=copy;
|
||||
param->recinfo=recinfo;
|
||||
store_record(table,2); // Make empty default record
|
||||
store_record(table,default_values); // Make empty default record
|
||||
|
||||
if (thd->variables.tmp_table_size == ~(ulong) 0) // No limit
|
||||
table->max_rows= ~(ha_rows) 0;
|
||||
@ -5055,7 +5064,7 @@ sub_select(JOIN *join,JOIN_TAB *join_tab,bool end_of_records)
|
||||
|
||||
if (!found && on_expr)
|
||||
{ // OUTER JOIN
|
||||
restore_record(join_tab->table,2); // Make empty record
|
||||
restore_record(join_tab->table,default_values); // Make empty record
|
||||
mark_as_null_row(join_tab->table); // For group by without error
|
||||
if (!select_cond || select_cond->val_int())
|
||||
{
|
||||
@ -5201,10 +5210,10 @@ join_read_system(JOIN_TAB *tab)
|
||||
empty_record(table); // Make empty record
|
||||
return -1;
|
||||
}
|
||||
store_record(table,1);
|
||||
store_record(table,record[1]);
|
||||
}
|
||||
else if (!table->status) // Only happens with left join
|
||||
restore_record(table,1); // restore old record
|
||||
restore_record(table,record[1]); // restore old record
|
||||
table->null_row=0;
|
||||
return table->status ? -1 : 0;
|
||||
}
|
||||
@ -5241,12 +5250,12 @@ join_read_const(JOIN_TAB *tab)
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
store_record(table,1);
|
||||
store_record(table,record[1]);
|
||||
}
|
||||
else if (!(table->status & ~STATUS_NULL_ROW)) // Only happens with left join
|
||||
{
|
||||
table->status=0;
|
||||
restore_record(table,1); // restore old record
|
||||
restore_record(table,record[1]); // restore old record
|
||||
}
|
||||
table->null_row=0;
|
||||
return table->status ? -1 : 0;
|
||||
@ -5843,7 +5852,7 @@ end_update(JOIN *join, JOIN_TAB *join_tab __attribute__((unused)),
|
||||
join->tmp_table_param.group_buff,0,
|
||||
HA_READ_KEY_EXACT))
|
||||
{ /* Update old record */
|
||||
restore_record(table,1);
|
||||
restore_record(table,record[1]);
|
||||
update_tmptable_sum_func(join->sum_funcs,table);
|
||||
if ((error=table->file->update_row(table->record[1],
|
||||
table->record[0])))
|
||||
@ -5912,7 +5921,7 @@ end_unique_update(JOIN *join, JOIN_TAB *join_tab __attribute__((unused)),
|
||||
table->file->print_error(error,MYF(0)); /* purecov: inspected */
|
||||
DBUG_RETURN(-1); /* purecov: inspected */
|
||||
}
|
||||
restore_record(table,1);
|
||||
restore_record(table,record[1]);
|
||||
update_tmptable_sum_func(join->sum_funcs,table);
|
||||
if ((error=table->file->update_row(table->record[1],
|
||||
table->record[0])))
|
||||
@ -7430,7 +7439,7 @@ get_sort_by_table(ORDER *a,ORDER *b,TABLE_LIST *tables)
|
||||
DBUG_RETURN(0);
|
||||
map|=a->item[0]->used_tables();
|
||||
}
|
||||
if (!map || (map & RAND_TABLE_BIT))
|
||||
if (!map || (map & (RAND_TABLE_BIT | OUTER_REF_TABLE_BIT)))
|
||||
DBUG_RETURN(0);
|
||||
|
||||
for (; !(map & tables->table->map) ; tables=tables->next) ;
|
||||
|
Reference in New Issue
Block a user