diff options
author | Varun Gupta <varunraiko1803@gmail.com> | 2017-12-30 10:18:22 +0530 |
---|---|---|
committer | Varun Gupta <varunraiko1803@gmail.com> | 2017-12-30 10:18:22 +0530 |
commit | a118c20c8151a4e95f133b6d5bf92bafc7835e23 (patch) | |
tree | b74a4d00cb0a8e07b631d3ca68c39baab52a1491 /sql/sql_explain.cc | |
parent | 8bcbcac053b96a39465e4651f51e625c37f94964 (diff) | |
download | mariadb-git-a118c20c8151a4e95f133b6d5bf92bafc7835e23.tar.gz |
MDEV-10844: EXPLAIN FORMAT=JSON doesn't show order direction for filesort
Currently explain format=json does not show the order direction of fields used during filesort.
This patch would remove this limitation
Diffstat (limited to 'sql/sql_explain.cc')
-rw-r--r-- | sql/sql_explain.cc | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/sql/sql_explain.cc b/sql/sql_explain.cc index 9b474fd5dee..e2daad12eae 100644 --- a/sql/sql_explain.cc +++ b/sql/sql_explain.cc @@ -927,6 +927,7 @@ Explain_aggr_filesort::Explain_aggr_filesort(MEM_ROOT *mem_root, for (ORDER *ord= filesort->order; ord; ord= ord->next) { sort_items.push_back(ord->item[0], mem_root); + sort_directions.push_back(&ord->direction, mem_root); } filesort->tracker= &tracker; } @@ -940,10 +941,13 @@ void Explain_aggr_filesort::print_json_members(Json_writer *writer, str.length(0); List_iterator_fast<Item> it(sort_items); - Item *item; + List_iterator_fast<ORDER::enum_order> it_dir(sort_directions); + Item* item; + ORDER::enum_order *direction; bool first= true; while ((item= it++)) { + direction= it_dir++; if (first) first= false; else @@ -951,6 +955,8 @@ void Explain_aggr_filesort::print_json_members(Json_writer *writer, str.append(", "); } append_item_to_str(&str, item); + if (*direction == ORDER::ORDER_DESC) + str.append(" desc"); } writer->add_member("sort_key").add_str(str.c_ptr_safe()); |