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

Function join_read_const_table

sql/sql_select.cc:25129–25240  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

25127*/
25128
25129static int
25130join_read_const_table(THD *thd, JOIN_TAB *tab, POSITION *pos)
25131{
25132 int error;
25133 TABLE_LIST *tbl;
25134 DBUG_ENTER("join_read_const_table");
25135 TABLE *table=tab->table;
25136 table->const_table=1;
25137 table->null_row=0;
25138 table->status=STATUS_NO_RECORD;
25139
25140 if (tab->table->pos_in_table_list->is_materialized_derived() &&
25141 !tab->table->pos_in_table_list->fill_me)
25142 {
25143 DBUG_ASSERT(0);
25144 //TODO: don't get here at all
25145 /*
25146 Skip materialized derived tables/views as they temporary table is not
25147 opened yet.
25148 */
25149 DBUG_RETURN(0);
25150 }
25151 else if (tab->table->pos_in_table_list->jtbm_subselect &&
25152 tab->table->pos_in_table_list->jtbm_subselect->is_jtbm_const_tab)
25153 {
25154 /* Row will not be found */
25155 int res;
25156 if (tab->table->pos_in_table_list->jtbm_subselect->jtbm_const_row_found)
25157 res= 0;
25158 else
25159 res= -1;
25160 DBUG_RETURN(res);
25161 }
25162 else if (tab->type == JT_SYSTEM)
25163 {
25164 if (unlikely((error=join_read_system(tab))))
25165 { // Info for DESCRIBE
25166 tab->info= ET_CONST_ROW_NOT_FOUND;
25167 /* Mark for EXPLAIN that the row was not found */
25168 pos->records_read= pos->records_out= 0.0;
25169 pos->ref_depend_map= 0;
25170 if (!table->pos_in_table_list->outer_join || error > 0)
25171 DBUG_RETURN(error);
25172 }
25173 /*
25174 The optimizer trust the engine that when stats.records is 0, there
25175 was no found rows
25176 */
25177 DBUG_ASSERT(table->file->stats.records > 0 || error);
25178 }
25179 else
25180 {
25181 error=join_read_const(tab);
25182 if (unlikely(error))
25183 {
25184 tab->info= ET_UNIQUE_ROW_NOT_FOUND;
25185 /* Mark for EXPLAIN that the row was not found */
25186 pos->records_read= pos->records_out= 0.0;

Callers 1

make_join_statisticsFunction · 0.85

Calls 10

join_read_systemFunction · 0.85
join_read_constFunction · 0.85
mark_as_null_rowFunction · 0.85
update_const_equal_itemsFunction · 0.85
is_expensiveMethod · 0.45
update_used_tablesMethod · 0.45
const_itemMethod · 0.45
val_boolMethod · 0.45
headMethod · 0.45

Tested by

no test coverage detected