[Commits] 21a8b60: MDEV-7834: ANALYZE FORMAT=JSON output column should be named ANALYZE

sanja at mariadb.com sanja at mariadb.com
Wed Mar 25 20:11:49 EET 2015


revision-id: 21a8b600634d4f8aa2a4db136d6a3811d739a504
parent(s): 34fcc28e7b89034f50b0fe15df738c02c7608a0d
committer: Oleksandr Byelkin
branch nick: server
timestamp: 2015-03-25 19:11:46 +0100
message:

MDEV-7834: ANALYZE FORMAT=JSON  output column should be named ANALYZE

---
 mysql-test/r/analyze_format_json.result | 14 +++++++-------
 sql/sql_class.cc                        |  9 ++++++---
 sql/sql_class.h                         |  2 +-
 3 files changed, 14 insertions(+), 11 deletions(-)

diff --git a/mysql-test/r/analyze_format_json.result b/mysql-test/r/analyze_format_json.result
index 26625cb..96b2550 100644
--- a/mysql-test/r/analyze_format_json.result
+++ b/mysql-test/r/analyze_format_json.result
@@ -3,7 +3,7 @@ create table t0 (a int);
 INSERT INTO t0 VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
 # r_filtered=30%, because 3 rows match: 0,1,2
 analyze format=json select * from t0 where a<3;
-EXPLAIN
+ANALYZE
 {
   "query_block": {
     "select_id": 1,
@@ -28,7 +28,7 @@ id	select_type	table	type	possible_keys	key	key_len	ref	rows	r_rows	filtered	r_f
 1	SIMPLE	t1	ref	a	a	5	test.t0.a	1	NULL	100.00	NULL	
 analyze format=json 
 select * from t0, t1 where t1.a=t0.a and t0.a > 9;
-EXPLAIN
+ANALYZE
 {
   "query_block": {
     "select_id": 1,
@@ -65,7 +65,7 @@ id	select_type	table	type	possible_keys	key	key_len	ref	rows	r_rows	filtered	r_f
 1	SIMPLE	t1	ref	a	a	5	test.t0.a	1	1.00	100.00	40.00	Using where
 analyze format=json
 select * from t0, t1 where t1.a=t0.a and t1.b<4;
-EXPLAIN
+ANALYZE
 {
   "query_block": {
     "select_id": 1,
@@ -103,7 +103,7 @@ id	select_type	table	type	possible_keys	key	key_len	ref	rows	r_rows	filtered	r_f
 1	SIMPLE	tbl2	ALL	NULL	NULL	NULL	NULL	100	100.00	100.00	94.00	Using where; Using join buffer (flat, BNL join)
 analyze format=json
 select * from t1 tbl1, t1 tbl2 where tbl1.b<20 and tbl2.b<60;
-EXPLAIN
+ANALYZE
 {
   "query_block": {
     "select_id": 1,
@@ -136,7 +136,7 @@ EXPLAIN
 }
 analyze format=json
 select * from t1 tbl1, t1 tbl2 where tbl1.b<20 and tbl2.b<60 and tbl1.c > tbl2.c;
-EXPLAIN
+ANALYZE
 {
   "query_block": {
     "select_id": 1,
@@ -178,7 +178,7 @@ insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
 create table t2 (a int, key(a));
 insert into t2 values (0),(1);
 analyze format=json select * from t1 straight_join t2 force index(a) where t2.a=t1.a;
-EXPLAIN
+ANALYZE
 {
   "query_block": {
     "select_id": 1,
@@ -222,7 +222,7 @@ select database();
 database()
 NULL
 analyze format=json select * from test.t1 where t1.a<5;
-EXPLAIN
+ANALYZE
 {
   "query_block": {
     "select_id": 1,
diff --git a/sql/sql_class.cc b/sql/sql_class.cc
index ff27bfb..1eec73b 100644
--- a/sql/sql_class.cc
+++ b/sql/sql_class.cc
@@ -2464,7 +2464,7 @@ int THD::send_explain_fields(select_result *result, uint8 explain_flags, bool is
 {
   List<Item> field_list;
   if (lex->explain_json)
-    make_explain_json_field_list(field_list);
+    make_explain_json_field_list(field_list, is_analyze);
   else
     make_explain_field_list(field_list, explain_flags, is_analyze);
 
@@ -2475,9 +2475,12 @@ int THD::send_explain_fields(select_result *result, uint8 explain_flags, bool is
 }
 
 
-void THD::make_explain_json_field_list(List<Item> &field_list)
+void THD::make_explain_json_field_list(List<Item> &field_list, bool is_analyze)
 {
-  Item *item= new Item_empty_string("EXPLAIN", 78, system_charset_info);
+  Item *item= new Item_empty_string((is_analyze ?
+                                     "ANALYZE" :
+                                     "EXPLAIN"),
+                                    78, system_charset_info);
   field_list.push_back(item);
 }
 
diff --git a/sql/sql_class.h b/sql/sql_class.h
index d391d25..293527e 100644
--- a/sql/sql_class.h
+++ b/sql/sql_class.h
@@ -3171,7 +3171,7 @@ class THD :public Statement,
                           bool is_analyze);
   void make_explain_field_list(List<Item> &field_list, uint8 explain_flags,
                                bool is_analyze);
-  void make_explain_json_field_list(List<Item> &field_list);
+  void make_explain_json_field_list(List<Item> &field_list, bool is_analyze);
 
   /**
     Clear the current error, if any.


More information about the commits mailing list