| 33807 | */ |
| 33808 | |
| 33809 | bool |
| 33810 | AGGR_OP::prepare_tmp_table() |
| 33811 | { |
| 33812 | TABLE *table= join_tab->table; |
| 33813 | JOIN *join= join_tab->join; |
| 33814 | int rc= 0; |
| 33815 | |
| 33816 | if (!join_tab->table->is_created()) |
| 33817 | { |
| 33818 | if (instantiate_tmp_table(table, join_tab->tmp_table_param->keyinfo, |
| 33819 | join_tab->tmp_table_param->start_recinfo, |
| 33820 | &join_tab->tmp_table_param->recinfo, |
| 33821 | join->select_options)) |
| 33822 | return true; |
| 33823 | (void) table->file->extra(HA_EXTRA_WRITE_CACHE); |
| 33824 | } |
| 33825 | /* If it wasn't already, start index scan for grouping using table index. */ |
| 33826 | if (!table->file->inited && table->group && |
| 33827 | join_tab->tmp_table_param->sum_func_count && table->s->keys) |
| 33828 | rc= table->file->ha_index_init(0, 0); |
| 33829 | else |
| 33830 | { |
| 33831 | /* Start index scan in scanning mode */ |
| 33832 | rc= table->file->ha_rnd_init(true); |
| 33833 | } |
| 33834 | if (rc) |
| 33835 | { |
| 33836 | table->file->print_error(rc, MYF(0)); |
| 33837 | return true; |
| 33838 | } |
| 33839 | return false; |
| 33840 | } |
| 33841 | |
| 33842 | |
| 33843 | /** |
nothing calls this directly
no test coverage detected