summaryrefslogtreecommitdiff
path: root/sql/sql_explain.cc
diff options
context:
space:
mode:
authorSergei Petrunia <psergey@askmonty.org>2015-04-08 16:25:01 +0300
committerSergei Petrunia <psergey@askmonty.org>2015-04-08 16:26:22 +0300
commit66ff1632f53ef2378c2f2546e0716547ee5d3217 (patch)
tree4591cd107c0e0deada9a53bece3a99015011ecb3 /sql/sql_explain.cc
parent82b9eb5e3aec2738411293c9aea498b05e21a715 (diff)
downloadmariadb-git-66ff1632f53ef2378c2f2546e0716547ee5d3217.tar.gz
MDEV-7860: EXPLAIN FORMAT=JSON crashes for loose scan query
(Based on original patch by Sanja Byelkin) Make the code that produces JSON output handle LooseScan quick select. The output we produce is compatible with MySQL 5.6.
Diffstat (limited to 'sql/sql_explain.cc')
-rw-r--r--sql/sql_explain.cc10
1 files changed, 8 insertions, 2 deletions
diff --git a/sql/sql_explain.cc b/sql/sql_explain.cc
index 36121aa1e01..15f6753130c 100644
--- a/sql/sql_explain.cc
+++ b/sql/sql_explain.cc
@@ -1201,6 +1201,13 @@ void Explain_table_access::tag_to_json(Json_writer *writer, enum explain_extra_t
case ET_USING_MRR:
writer->add_member("mrr_type").add_str(mrr_type.c_ptr());
break;
+ case ET_USING_INDEX_FOR_GROUP_BY:
+ writer->add_member("using_index_for_group_by");
+ if (loose_scan_is_scanning)
+ writer->add_str("scanning");
+ else
+ writer->add_bool(true);
+ break;
default:
DBUG_ASSERT(0);
}
@@ -1572,8 +1579,7 @@ void Explain_quick_select::print_json(Json_writer *writer)
void Explain_quick_select::print_extra_recursive(String *str)
{
- if (quick_type == QUICK_SELECT_I::QS_TYPE_RANGE ||
- quick_type == QUICK_SELECT_I::QS_TYPE_RANGE_DESC)
+ if (is_basic())
{
str->append(range.get_key_name());
}