diff options
Diffstat (limited to 'sql/sql_select.cc')
-rw-r--r-- | sql/sql_select.cc | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/sql/sql_select.cc b/sql/sql_select.cc index e517c05c161..cacaea44d12 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -12,7 +12,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ /** @file @@ -8133,6 +8133,7 @@ JOIN::make_simple_join(JOIN *parent, TABLE *temp_table) join_tab->ref.key = -1; join_tab->read_first_record= join_init_read_record; join_tab->join= this; + join_tab->ref.key_parts= 0; bzero((char*) &join_tab->read_record,sizeof(join_tab->read_record)); temp_table->status=0; temp_table->null_row=0; @@ -14015,7 +14016,7 @@ static Field *create_tmp_field_from_item(THD *thd, Item *item, TABLE *table, if (new_field) new_field->init(table); - if (copy_func && item->is_result_field()) + if (copy_func && item->real_item()->is_result_field()) *((*copy_func)++) = item; // Save for copy_funcs if (modify_item) item->set_result_field(new_field); @@ -19307,7 +19308,17 @@ create_sort_index(THD *thd, JOIN *join, ORDER *order, tablesort_result_cache= table->sort.io_cache; table->sort.io_cache= NULL; - // select->cleanup(); // filesort did select + if (select->quick && + select->quick->get_type() == QUICK_SELECT_I::QS_TYPE_GROUP_MIN_MAX) + { + tab->filesort_used_loose_index_scan= true; + + QUICK_GROUP_MIN_MAX_SELECT *minmax_quick= + static_cast<QUICK_GROUP_MIN_MAX_SELECT*>(select->quick); + if (minmax_quick->is_agg_distinct()) + tab->filesort_used_loose_index_scan_agg_distinct= true; + } + /* If a quick object was created outside of create_sort_index() that might be reused, then do not call select->cleanup() since |