summaryrefslogtreecommitdiff
path: root/sql/filesort.cc
diff options
context:
space:
mode:
authorOleksandr Byelkin <sanja@mariadb.com>2020-10-31 21:06:49 +0100
committerOleksandr Byelkin <sanja@mariadb.com>2020-10-31 21:06:49 +0100
commit80c951ce2875aac521b82323b5b6ebf638593445 (patch)
treedf22c24e1fbe48362bd0eed50ec0c164e6c7e674 /sql/filesort.cc
parent1fddccf676e213f94923f5efaaa76d9793b19a89 (diff)
parent794f66513967891520ec432123dcff8270871b93 (diff)
downloadmariadb-git-80c951ce2875aac521b82323b5b6ebf638593445.tar.gz
Merge branch '10.3' into 10.4
Diffstat (limited to 'sql/filesort.cc')
-rw-r--r--sql/filesort.cc14
1 files changed, 13 insertions, 1 deletions
diff --git a/sql/filesort.cc b/sql/filesort.cc
index aa25474be1a..ad4cb2b6e6b 100644
--- a/sql/filesort.cc
+++ b/sql/filesort.cc
@@ -1978,7 +1978,14 @@ sortlength(THD *thd, SORT_FIELD *sortorder, uint s_length,
if (sortorder->field)
{
CHARSET_INFO *cs= sortorder->field->sort_charset();
+ sortorder->type= sortorder->field->is_packable() ?
+ SORT_FIELD_ATTR::VARIABLE_SIZE :
+ SORT_FIELD_ATTR::FIXED_SIZE;
+
sortorder->length= sortorder->field->sort_length();
+ if (sortorder->is_variable_sized())
+ set_if_smaller(sortorder->length, thd->variables.max_sort_length);
+
if (use_strnxfrm((cs=sortorder->field->sort_charset())))
{
*multi_byte_charset= true;
@@ -1989,6 +1996,10 @@ sortlength(THD *thd, SORT_FIELD *sortorder, uint s_length,
}
else
{
+ sortorder->type= sortorder->item->type_handler()->is_packable() ?
+ SORT_FIELD_ATTR::VARIABLE_SIZE :
+ SORT_FIELD_ATTR::FIXED_SIZE;
+
sortorder->item->type_handler()->sortlength(thd, sortorder->item,
sortorder);
if (use_strnxfrm(sortorder->item->collation.collation))
@@ -1998,7 +2009,8 @@ sortlength(THD *thd, SORT_FIELD *sortorder, uint s_length,
if (sortorder->item->maybe_null)
length++; // Place for NULL marker
}
- set_if_smaller(sortorder->length, thd->variables.max_sort_length);
+ if (sortorder->is_variable_sized())
+ set_if_smaller(sortorder->length, thd->variables.max_sort_length);
length+=sortorder->length;
}
sortorder->field= (Field*) 0; // end marker