Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
d1a1ad4c
Commit
d1a1ad4c
authored
Feb 02, 2022
by
Oleg Smirnov
Committed by
Sergei Petrunia
Apr 29, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MDEV-27021 Add support of FORMAT=JSON for SHOW ANALYZE
parent
e7fcd496
Changes
6
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
1634 additions
and
23 deletions
+1634
-23
mysql-test/main/show_analyze_json.result
mysql-test/main/show_analyze_json.result
+1229
-0
mysql-test/main/show_analyze_json.test
mysql-test/main/show_analyze_json.test
+368
-0
mysql-test/main/show_explain_json.result
mysql-test/main/show_explain_json.result
+7
-7
sql/handler.h
sql/handler.h
+2
-1
sql/sql_show.cc
sql/sql_show.cc
+21
-9
sql/sql_yacc.yy
sql/sql_yacc.yy
+7
-6
No files found.
mysql-test/main/show_analyze_json.result
0 → 100644
View file @
d1a1ad4c
This diff is collapsed.
Click to expand it.
mysql-test/main/show_analyze_json.test
0 → 100644
View file @
d1a1ad4c
This diff is collapsed.
Click to expand it.
mysql-test/main/show_explain_json.result
View file @
d1a1ad4c
...
@@ -26,17 +26,17 @@ connection con1;
...
@@ -26,17 +26,17 @@ connection con1;
SET @old_debug= @@session.debug;
SET @old_debug= @@session.debug;
connection default;
connection default;
show explain format=JSON for $thr2;
show explain format=JSON for $thr2;
ERROR HY000: Target is not
running an EXPLAINable command
ERROR HY000: Target is not
executing an operation with a query plan
explain format=json for connection $thr2;
explain format=json for connection $thr2;
ERROR HY000: Target is not
running an EXPLAINable command
ERROR HY000: Target is not
executing an operation with a query plan
show explain format=json for $thr1;
show explain format=json for $thr1;
ERROR HY000: Target is not
running an EXPLAINable command
ERROR HY000: Target is not
executing an operation with a query plan
explain FORMAT=JSON for connection $thr1;
explain FORMAT=JSON for connection $thr1;
ERROR HY000: Target is not
running an EXPLAINable command
ERROR HY000: Target is not
executing an operation with a query plan
show explain FORMAT=HTML for $thr1;
show explain FORMAT=HTML for $thr1;
ERROR HY000: Unknown EXPLAIN format name: 'HTML'
ERROR HY000: Unknown EXPLAIN
/ANALYZE
format name: 'HTML'
explain FORMAT=XML for connection $thr1;
explain FORMAT=XML for connection $thr1;
ERROR HY000: Unknown EXPLAIN format name: 'XML'
ERROR HY000: Unknown EXPLAIN
/ANALYZE
format name: 'XML'
connection con1;
connection con1;
set @show_explain_probe_select_id=1;
set @show_explain_probe_select_id=1;
SET debug_dbug='+d,show_explain_probe_join_exec_start';
SET debug_dbug='+d,show_explain_probe_join_exec_start';
...
@@ -523,7 +523,7 @@ SET debug_dbug='+d,show_explain_probe_join_exec_start';
...
@@ -523,7 +523,7 @@ SET debug_dbug='+d,show_explain_probe_join_exec_start';
set @foo= (select max(a) from t0 where sin(a) >0);
set @foo= (select max(a) from t0 where sin(a) >0);
connection default;
connection default;
show explain format=JSON for $thr2;
show explain format=JSON for $thr2;
ERROR HY000: Target is not
running an EXPLAINable command
ERROR HY000: Target is not
executing an operation with a query plan
kill query $thr2;
kill query $thr2;
connection con1;
connection con1;
ERROR 70100: Query execution was interrupted
ERROR 70100: Query execution was interrupted
...
...
sql/handler.h
View file @
d1a1ad4c
...
@@ -1025,7 +1025,8 @@ enum enum_schema_tables
...
@@ -1025,7 +1025,8 @@ enum enum_schema_tables
SCH_EVENTS
,
SCH_EVENTS
,
SCH_EXPLAIN_TABULAR
,
SCH_EXPLAIN_TABULAR
,
SCH_EXPLAIN_JSON
,
SCH_EXPLAIN_JSON
,
SCH_ANALYZE
,
SCH_ANALYZE_TABULAR
,
SCH_ANALYZE_JSON
,
SCH_FILES
,
SCH_FILES
,
SCH_GLOBAL_STATUS
,
SCH_GLOBAL_STATUS
,
SCH_GLOBAL_VARIABLES
,
SCH_GLOBAL_VARIABLES
,
...
...
sql/sql_show.cc
View file @
d1a1ad4c
...
@@ -3242,13 +3242,14 @@ int fill_show_explain_tabular(THD *thd, TABLE_LIST *table, COND *cond)
...
@@ -3242,13 +3242,14 @@ int fill_show_explain_tabular(THD *thd, TABLE_LIST *table, COND *cond)
int
fill_show_explain_json
(
THD
*
thd
,
TABLE_LIST
*
table
,
COND
*
cond
)
int
fill_show_explain_json
(
THD
*
thd
,
TABLE_LIST
*
table
,
COND
*
cond
)
{
{
return
fill_show_explain_or_analyze
(
return
fill_show_explain_or_analyze
(
thd
,
table
,
cond
,
TRUE
/* json_format */
,
TRUE
/* is_analyze */
);
thd
,
table
,
cond
,
TRUE
/* json_format */
,
FALSE
/* is_analyze */
);
}
int
fill_show_analyze_tabular
(
THD
*
thd
,
TABLE_LIST
*
table
,
COND
*
cond
)
int
fill_show_analyze_tabular
(
THD
*
thd
,
TABLE_LIST
*
table
,
COND
*
cond
)
{
{
return
fill_show_explain_or_analyze
(
return
fill_show_explain_or_analyze
(
thd
,
table
,
cond
,
FALSE
/* json_format */
,
TRUE
/* is_analyze */
);
thd
,
table
,
cond
,
FALSE
/* json_format */
,
TRUE
/* is_analyze */
);
}
}
...
@@ -9676,7 +9677,7 @@ ST_FIELD_INFO show_explain_json_fields_info[]=
...
@@ -9676,7 +9677,7 @@ ST_FIELD_INFO show_explain_json_fields_info[]=
};
};
ST_FIELD_INFO
show_analyze_fields_info
[]
=
ST_FIELD_INFO
show_analyze_
tabular_
fields_info
[]
=
{
{
Column
(
"id"
,
SLonglong
(
3
),
NULLABLE
,
"id"
),
Column
(
"id"
,
SLonglong
(
3
),
NULLABLE
,
"id"
),
Column
(
"select_type"
,
Varchar
(
19
),
NOT_NULL
,
"select_type"
),
Column
(
"select_type"
,
Varchar
(
19
),
NOT_NULL
,
"select_type"
),
...
@@ -9699,6 +9700,11 @@ ST_FIELD_INFO show_analyze_fields_info[]=
...
@@ -9699,6 +9700,11 @@ ST_FIELD_INFO show_analyze_fields_info[]=
};
};
ST_FIELD_INFO
show_analyze_json_fields_info
[]
=
{
Column
(
"EXPLAIN"
,
Longtext
(
MAX_FIELD_VARCHARLENGTH
),
NOT_NULL
,
"ANALYZE"
),
CEnd
()};
ST_FIELD_INFO
check_constraints_fields_info
[]
=
ST_FIELD_INFO
check_constraints_fields_info
[]
=
{
{
Column
(
"CONSTRAINT_CATALOG"
,
Catalog
(),
NOT_NULL
,
OPEN_FULL_TABLE
),
Column
(
"CONSTRAINT_CATALOG"
,
Catalog
(),
NOT_NULL
,
OPEN_FULL_TABLE
),
...
@@ -9759,12 +9765,18 @@ ST_SCHEMA_TABLE schema_tables[]=
...
@@ -9759,12 +9765,18 @@ ST_SCHEMA_TABLE schema_tables[]=
{
"EVENTS"
,
Show
::
events_fields_info
,
0
,
{
"EVENTS"
,
Show
::
events_fields_info
,
0
,
0
,
make_old_format
,
0
,
-
1
,
-
1
,
0
,
0
},
0
,
make_old_format
,
0
,
-
1
,
-
1
,
0
,
0
},
#endif
#endif
{
"EXPLAIN"
,
Show
::
show_explain_tabular_fields_info
,
0
,
fill_show_explain_tabular
,
{
"EXPLAIN"
,
Show
::
show_explain_tabular_fields_info
,
0
,
make_old_format
,
0
,
-
1
,
-
1
,
TRUE
/*hidden*/
,
0
},
fill_show_explain_tabular
,
make_old_format
,
0
,
-
1
,
-
1
,
{
"EXPLAIN_JSON"
,
Show
::
show_explain_json_fields_info
,
0
,
fill_show_explain_json
,
TRUE
/*hidden*/
,
0
},
make_old_format
,
0
,
-
1
,
-
1
,
TRUE
/*hidden*/
,
0
},
{
"EXPLAIN_JSON"
,
Show
::
show_explain_json_fields_info
,
0
,
{
"ANALYZE"
,
Show
::
show_analyze_fields_info
,
0
,
fill_show_analyze_tabular
,
fill_show_explain_json
,
make_old_format
,
0
,
-
1
,
-
1
,
make_old_format
,
0
,
-
1
,
-
1
,
TRUE
/*hidden*/
,
0
},
TRUE
/*hidden*/
,
0
},
{
"ANALYZE"
,
Show
::
show_analyze_tabular_fields_info
,
0
,
fill_show_analyze_tabular
,
make_old_format
,
0
,
-
1
,
-
1
,
TRUE
/*hidden*/
,
0
},
{
"ANALYZE_JSON"
,
Show
::
show_analyze_json_fields_info
,
0
,
fill_show_analyze_json
,
make_old_format
,
0
,
-
1
,
-
1
,
TRUE
/*hidden*/
,
0
},
{
"FILES"
,
Show
::
files_fields_info
,
0
,
{
"FILES"
,
Show
::
files_fields_info
,
0
,
hton_fill_schema_table
,
0
,
0
,
-
1
,
-
1
,
0
,
0
},
hton_fill_schema_table
,
0
,
0
,
-
1
,
-
1
,
0
,
0
},
{
"GLOBAL_STATUS"
,
Show
::
variables_fields_info
,
0
,
{
"GLOBAL_STATUS"
,
Show
::
variables_fields_info
,
0
,
...
...
sql/sql_yacc.yy
View file @
d1a1ad4c
...
@@ -13944,16 +13944,17 @@ show_param:
...
@@ -13944,16 +13944,17 @@ show_param:
{
{
Lex->sql_command= SQLCOM_SHOW_EXPLAIN;
Lex->sql_command= SQLCOM_SHOW_EXPLAIN;
if (unlikely(prepare_schema_table(thd, Lex, 0,
if (unlikely(prepare_schema_table(thd, Lex, 0,
Lex->explain_json ? SCH_EXPLAIN_JSON : SCH_EXPLAIN_TABULAR)))
Lex->explain_json ? SCH_EXPLAIN_JSON : SCH_EXPLAIN_TABULAR)))
MYSQL_YYABORT;
MYSQL_YYABORT;
add_value_to_list(thd, $4);
add_value_to_list(thd, $4);
}
}
| ANALYZE_SYM FOR_SYM expr
| ANALYZE_SYM
opt_format_json
FOR_SYM expr
{
{
Lex->sql_command= SQLCOM_SHOW_ANALYZE;
Lex->sql_command= SQLCOM_SHOW_ANALYZE;
if (unlikely(prepare_schema_table(thd, Lex, 0, SCH_ANALYZE)))
if (unlikely(prepare_schema_table(thd, Lex, 0,
Lex->explain_json ? SCH_ANALYZE_JSON : SCH_ANALYZE_TABULAR)))
MYSQL_YYABORT;
MYSQL_YYABORT;
add_value_to_list(thd, $
3
);
add_value_to_list(thd, $
4
);
}
}
| IDENT_sys remember_tok_start wild_and_where
| IDENT_sys remember_tok_start wild_and_where
{
{
...
@@ -14107,8 +14108,8 @@ opt_format_json:
...
@@ -14107,8 +14108,8 @@ opt_format_json:
else if (lex_string_eq(&$3, STRING_WITH_LEN("TRADITIONAL")))
else if (lex_string_eq(&$3, STRING_WITH_LEN("TRADITIONAL")))
DBUG_ASSERT(Lex->explain_json==false);
DBUG_ASSERT(Lex->explain_json==false);
else
else
my_yyabort_error((ER_UNKNOWN_EXPLAIN_FORMAT, MYF(0),
"EXPLAIN",
my_yyabort_error((ER_UNKNOWN_EXPLAIN_FORMAT, MYF(0),
$3.str));
"EXPLAIN/ANALYZE",
$3.str));
}
}
;
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment