@@ -473,7 +473,8 @@ impl SqlServiceImpl {
473473 ) )
474474 } else {
475475 Err ( CubeError :: user (
476- "EXPLAIN ANALYZE is not supported for selects from system tables" . to_string ( ) ,
476+ "EXPLAIN ANALYZE is not supported for selects from system tables"
477+ . to_string ( ) ,
477478 ) )
478479 }
479480 }
@@ -3847,6 +3848,33 @@ mod tests {
38473848 )
38483849 }
38493850
3851+ #[ tokio:: test]
3852+ async fn explain_meta_logical_plan ( ) {
3853+ Config :: run_test ( "explain_meta_logical_plan" , async move |services| {
3854+ let service = services. sql_service ;
3855+ service. exec_query ( "CREATE SCHEMA foo" ) . await . unwrap ( ) ;
3856+
3857+ let result = service. exec_query (
3858+ "EXPLAIN SELECT table_name FROM information_schema.tables WHERE table_schema = 'foo'"
3859+ ) . await . unwrap ( ) ;
3860+ assert_eq ! ( result. len( ) , 1 ) ;
3861+ assert_eq ! ( result. get_columns( ) . len( ) , 1 ) ;
3862+
3863+ let pp_plan = match & result
3864+ . get_rows ( ) [ 0 ]
3865+ . values ( ) [ 0 ] {
3866+ TableValue :: String ( pp_plan) => pp_plan,
3867+ _ => { assert ! ( false ) ; "" }
3868+ } ;
3869+ assert_eq ! (
3870+ pp_plan,
3871+ "Projection, [information_schema.tables.table_name]\
3872+ \n Filter\
3873+ \n Scan information_schema.tables, source: InfoSchemaTableProvider, fields: [table_schema, table_name]"
3874+ ) ;
3875+ } ) . await ;
3876+ }
3877+
38503878 #[ tokio:: test]
38513879 async fn explain_logical_plan ( ) {
38523880 Config :: run_test ( "explain_logical_plan" , async move |services| {
@@ -3881,6 +3909,7 @@ mod tests {
38813909 ) ;
38823910 } ) . await ;
38833911 }
3912+
38843913 #[ tokio:: test]
38853914 async fn explain_physical_plan ( ) {
38863915 Config :: test ( "explain_analyze_router" ) . update_config ( |mut config| {
@@ -3891,7 +3920,7 @@ mod tests {
38913920 } ) . start_test ( async move |services| {
38923921 let service = services. sql_service ;
38933922
3894- Config :: test ( "expalain_analyze_worker_1 " ) . update_config ( |mut config| {
3923+ Config :: test ( "explain_analyze_worker_1 " ) . update_config ( |mut config| {
38953924 config. worker_bind_address = Some ( "127.0.0.1:14006" . to_string ( ) ) ;
38963925 config. server_name = "127.0.0.1:14006" . to_string ( ) ;
38973926 config. metastore_remote_address = Some ( "127.0.0.1:15006" . to_string ( ) ) ;
0 commit comments