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

Method join_matching_records

sql/sql_join_cache.cc:2320–2443  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2318*/
2319
2320enum_nested_loop_state JOIN_CACHE::join_matching_records(bool skip_last)
2321{
2322 int error;
2323 enum_nested_loop_state rc= NESTED_LOOP_OK;
2324 join_tab->table->null_row= 0;
2325 bool check_only_first_match= join_tab->check_only_first_match();
2326 DBUG_ENTER("JOIN_CACHE::join_matching_records");
2327
2328 /* Return at once if there are no records in the join buffer */
2329 if (!records)
2330 DBUG_RETURN(NESTED_LOOP_OK);
2331
2332 /*
2333 When joining we read records from the join buffer back into record buffers.
2334 If matches for the last partial join record are found through a call to
2335 the sub_select function then this partial join record must be saved in the
2336 join buffer in order to be restored just before the sub_select call.
2337 */
2338 if (skip_last)
2339 put_record();
2340
2341 if (join_tab->use_quick == 2 && join_tab->select->quick)
2342 {
2343 /* A dynamic range access was used last. Clean up after it */
2344 delete join_tab->select->quick;
2345 join_tab->select->quick= 0;
2346 }
2347
2348 if ((rc= join_tab_execution_startup(join_tab)) < 0)
2349 goto finish2;
2350
2351 if (join_tab->need_to_build_rowid_filter &&
2352 join_tab->build_range_rowid_filter())
2353 {
2354 rc= NESTED_LOOP_ERROR;
2355 goto finish2;
2356 }
2357
2358 /* Prepare to retrieve all records of the joined table */
2359 if (unlikely((error= join_tab_scan->open())))
2360 {
2361 /*
2362 TODO: if we get here, we will assert in net_send_statement(). Add test
2363 coverage and fix.
2364 */
2365 goto finish;
2366 }
2367
2368 while (!(error= join_tab_scan->next()))
2369 {
2370 if (unlikely(join->thd->check_killed()))
2371 {
2372 /* The user has aborted the execution of the query */
2373 rc= NESTED_LOOP_KILLED;
2374 goto finish;
2375 }
2376
2377 if (join_tab->keep_current_rowid)

Callers

nothing calls this directly

Calls 8

check_killedMethod · 0.80
openMethod · 0.45
nextMethod · 0.45
positionMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected