@@ -29,14 +29,17 @@ use datafusion::prelude::SessionContext;
2929use datafusion_cli:: catalog:: DynamicObjectStoreCatalog ;
3030use datafusion_cli:: functions:: ParquetMetadataFunc ;
3131use datafusion_cli:: {
32- exec,
32+ debuginfo , exec,
3333 pool_type:: PoolType ,
3434 print_format:: PrintFormat ,
3535 print_options:: { MaxRows , PrintOptions } ,
3636 DATAFUSION_CLI_VERSION ,
3737} ;
3838
3939use clap:: Parser ;
40+ use datafusion:: catalog:: CatalogProviderList ;
41+ use datafusion:: execution:: SessionStateBuilder ;
42+ use datafusion_cli:: symbolize:: { SymbolizeOptimizerRule , SymbolizeQueryPlanner } ;
4043use mimalloc:: MiMalloc ;
4144
4245#[ global_allocator]
@@ -170,14 +173,27 @@ async fn main_inner() -> Result<()> {
170173 let runtime_env = rt_builder. build_arc ( ) ?;
171174
172175 // enable dynamic file query
173- let ctx = SessionContext :: new_with_config_rt ( session_config, runtime_env)
174- . enable_url_table ( ) ;
176+ let state = SessionStateBuilder :: new ( )
177+ . with_config ( session_config)
178+ . with_runtime_env ( runtime_env)
179+ . with_default_features ( )
180+ . with_query_planner ( Arc :: new ( SymbolizeQueryPlanner { } ) )
181+ . with_optimizer_rule ( Arc :: new ( SymbolizeOptimizerRule { } ) )
182+ . build ( ) ;
183+ let ctx = SessionContext :: new_with_state ( state) . enable_url_table ( ) ;
175184 ctx. refresh_catalogs ( ) . await ?;
176185 // install dynamic catalog provider that can register required object stores
177- ctx. register_catalog_list ( Arc :: new ( DynamicObjectStoreCatalog :: new (
186+ println ! ( "catalog list {:?}" , ctx. state( ) . catalog_list( ) ) ;
187+ let dynamic_catalog = Arc :: new ( DynamicObjectStoreCatalog :: new (
178188 ctx. state ( ) . catalog_list ( ) . clone ( ) ,
179189 ctx. state_weak_ref ( ) ,
180- ) ) ) ;
190+ ) ) ;
191+ dynamic_catalog. register_catalog (
192+ "debuginfo" . to_string ( ) ,
193+ Arc :: new ( debuginfo:: CatalogProvider { } ) ,
194+ ) ;
195+ println ! ( "dynamic catalog list {:?}" , dynamic_catalog. catalog_names( ) ) ;
196+ ctx. register_catalog_list ( dynamic_catalog) ;
181197 // register `parquet_metadata` table function to get metadata from parquet files
182198 ctx. register_udtf ( "parquet_metadata" , Arc :: new ( ParquetMetadataFunc { } ) ) ;
183199
0 commit comments