diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2020-07-02 09:41:44 +0300 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2020-07-02 09:41:44 +0300 |
commit | 1813d92d0c505a1c752f4a9d6e37db6bffe4efdd (patch) | |
tree | f570314890197949ae55cbbad3a94eb5893c4177 /sql/filesort.cc | |
parent | 0fe97c20b341665058491fca4d665207406775c6 (diff) | |
parent | f347b3e0e6592329b1447fa460aca0a4b1f680b1 (diff) | |
download | mariadb-git-1813d92d0c505a1c752f4a9d6e37db6bffe4efdd.tar.gz |
Merge 10.4 into 10.5
Diffstat (limited to 'sql/filesort.cc')
-rw-r--r-- | sql/filesort.cc | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/sql/filesort.cc b/sql/filesort.cc index ac43c96b0e0..f5d57a36685 100644 --- a/sql/filesort.cc +++ b/sql/filesort.cc @@ -586,7 +586,14 @@ Filesort::make_sortorder(THD *thd, JOIN *join, table_map first_table_bit) if (item->type() == Item::FIELD_ITEM) pos->field= ((Item_field*) item)->field; else if (item->type() == Item::SUM_FUNC_ITEM && !item->const_item()) - pos->field= ((Item_sum*) item)->get_tmp_table_field(); + { + // Aggregate, or Item_aggregate_ref + DBUG_ASSERT(first->type() == Item::SUM_FUNC_ITEM || + (first->type() == Item::REF_ITEM && + static_cast<Item_ref*>(first)->ref_type() == + Item_ref::AGGREGATE_REF)); + pos->field= first->get_tmp_table_field(); + } else if (item->type() == Item::COPY_STR_ITEM) { // Blob patch pos->item= ((Item_copy*) item)->get_item(); |