MCPcopy Create free account
hub / github.com/MariaDB/server / sub_select

Function sub_select

sql/sql_select.cc:24622–24775  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

24620*/
24621
24622enum_nested_loop_state
24623sub_select(JOIN *join,JOIN_TAB *join_tab,bool end_of_records)
24624{
24625 int error;
24626 enum_nested_loop_state rc;
24627 DBUG_ENTER("sub_select");
24628
24629 if (join_tab->split_derived_to_update && !end_of_records)
24630 {
24631 table_map tab_map= join_tab->split_derived_to_update;
24632 for (uint i= 0; tab_map; i++, tab_map>>= 1)
24633 {
24634 if (tab_map & 1)
24635 join->map2table[i]->preread_init_done= false;
24636 }
24637 }
24638
24639 /* Restore state if mark_as_null_row() have been called */
24640 if (join_tab->last_inner)
24641 {
24642 JOIN_TAB *last_inner_tab= join_tab->last_inner;
24643 for (JOIN_TAB *jt= join_tab; jt <= last_inner_tab; jt++)
24644 jt->table->null_row= 0;
24645 }
24646 else
24647 join_tab->table->null_row=0;
24648
24649 if (end_of_records)
24650 {
24651 enum_nested_loop_state nls=
24652 (*join_tab->next_select)(join,join_tab+1,end_of_records);
24653 DBUG_RETURN(nls);
24654 }
24655 join_tab->tracker->r_scans++;
24656
24657 rc= NESTED_LOOP_OK;
24658
24659 for (SJ_TMP_TABLE *flush_dups_table= join_tab->flush_weedout_table;
24660 flush_dups_table;
24661 flush_dups_table= flush_dups_table->next_flush_table)
24662 {
24663 flush_dups_table->sj_weedout_delete_rows();
24664 }
24665
24666 if (!join_tab->preread_init_done && join_tab->preread_init())
24667 DBUG_RETURN(NESTED_LOOP_ERROR);
24668
24669 if (unlikely(join_tab->rowid_filter))
24670 {
24671 if (unlikely(join_tab->need_to_build_rowid_filter))
24672 {
24673 if (join_tab->build_range_rowid_filter())
24674 DBUG_RETURN(NESTED_LOOP_ERROR);
24675 /*
24676 We have to check join_tab->rowid_filter again as the above
24677 function may have cleared it in case of errors.
24678 */
24679 if (join_tab->rowid_filter && join_tab->rowid_filter->is_empty())

Callers 4

do_selectFunction · 0.85
sub_select_postjoin_aggrFunction · 0.85
sub_select_cacheFunction · 0.85

Calls 15

evaluate_join_recordFunction · 0.85
key_copyFunction · 0.85
preread_initMethod · 0.80
get_stmt_daMethod · 0.80
pfs_batch_updateMethod · 0.80
start_psi_batch_modeMethod · 0.80
read_recordMethod · 0.80
end_psi_batch_modeMethod · 0.80

Tested by

no test coverage detected