| 20223 | */ |
| 20224 | |
| 20225 | static uint build_bitmap_for_nested_joins(List<TABLE_LIST> *join_list, |
| 20226 | uint first_unused) |
| 20227 | { |
| 20228 | List_iterator<TABLE_LIST> li(*join_list); |
| 20229 | TABLE_LIST *table; |
| 20230 | DBUG_ENTER("build_bitmap_for_nested_joins"); |
| 20231 | while ((table= li++)) |
| 20232 | { |
| 20233 | NESTED_JOIN *nested_join; |
| 20234 | if ((nested_join= table->nested_join)) |
| 20235 | { |
| 20236 | /* |
| 20237 | It is guaranteed by simplify_joins() function that a nested join |
| 20238 | that has only one child represents a single table VIEW (and the child |
| 20239 | is an underlying table). We don't assign bits to such nested join |
| 20240 | structures because |
| 20241 | 1. it is redundant (a "sequence" of one table cannot be interleaved |
| 20242 | with anything) |
| 20243 | 2. we could run out bits in nested_join_map otherwise. |
| 20244 | */ |
| 20245 | if (nested_join->n_tables != 1) |
| 20246 | { |
| 20247 | /* Don't assign bits to sj-nests */ |
| 20248 | if (table->on_expr) |
| 20249 | nested_join->nj_map= (nested_join_map) 1 << first_unused++; |
| 20250 | first_unused= build_bitmap_for_nested_joins(&nested_join->join_list, |
| 20251 | first_unused); |
| 20252 | } |
| 20253 | } |
| 20254 | } |
| 20255 | DBUG_RETURN(first_unused); |
| 20256 | } |
| 20257 | |
| 20258 | |
| 20259 | /** |