1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-27 18:02:13 +03:00

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
This commit is contained in:
Varun Gupta
2017-12-30 10:18:22 +05:30
parent 8bcbcac053
commit a118c20c81
5 changed files with 80 additions and 2 deletions

View File

@ -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());