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

Function join_tab_execution_startup

sql/opt_subselect.cc:5978–6029  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5976*/
5977
5978enum_nested_loop_state join_tab_execution_startup(JOIN_TAB *tab)
5979{
5980 Item_in_subselect *in_subs;
5981 DBUG_ENTER("join_tab_execution_startup");
5982
5983 if (tab->table->pos_in_table_list &&
5984 (in_subs= tab->table->pos_in_table_list->jtbm_subselect))
5985 {
5986 /* It's a non-merged SJM nest */
5987 DBUG_ASSERT(in_subs->engine->engine_type() ==
5988 subselect_engine::HASH_SJ_ENGINE);
5989 subselect_hash_sj_engine *hash_sj_engine=
5990 ((subselect_hash_sj_engine*)in_subs->engine);
5991 if (!hash_sj_engine->is_materialized)
5992 {
5993 int error= hash_sj_engine->materialize_join->exec();
5994 hash_sj_engine->is_materialized= TRUE;
5995
5996 if (unlikely(error) ||
5997 unlikely(tab->join->thd->is_fatal_error))
5998 DBUG_RETURN(NESTED_LOOP_ERROR);
5999 }
6000 }
6001 else if (tab->bush_children)
6002 {
6003 /* It's a merged SJM nest */
6004 enum_nested_loop_state rc;
6005 SJ_MATERIALIZATION_INFO *sjm= tab->bush_children->start->emb_sj_nest->sj_mat_info;
6006
6007 if (!sjm->materialized)
6008 {
6009 JOIN *join= tab->join;
6010 JOIN_TAB *join_tab= tab->bush_children->start;
6011 JOIN_TAB *save_return_tab= join->return_tab;
6012 /*
6013 Now run the join for the inner tables. The first call is to run the
6014 join, the second one is to signal EOF (this is essential for some
6015 join strategies, e.g. it will make join buffering flush the records)
6016 */
6017 if ((rc= sub_select(join, join_tab, FALSE/* no EOF */)) < 0 ||
6018 (rc= sub_select(join, join_tab, TRUE/* now EOF */)) < 0)
6019 {
6020 join->return_tab= save_return_tab;
6021 DBUG_RETURN(rc); /* it's NESTED_LOOP_(ERROR|KILLED)*/
6022 }
6023 join->return_tab= save_return_tab;
6024 sjm->materialized= TRUE;
6025 }
6026 }
6027
6028 DBUG_RETURN(NESTED_LOOP_OK);
6029}
6030
6031
6032/*

Callers 2

join_matching_recordsMethod · 0.85
sub_selectFunction · 0.85

Calls 3

sub_selectFunction · 0.85
engine_typeMethod · 0.45
execMethod · 0.45

Tested by

no test coverage detected