@@ -55,6 +55,7 @@ use itertools::Itertools;
5555use object_store:: { path:: Path , ObjectStore } ;
5656use relative_path:: RelativePathBuf ;
5757use std:: { any:: Any , collections:: HashMap , ops:: Bound , sync:: Arc } ;
58+ use tracing:: { instrument, span, Level } ;
5859use url:: Url ;
5960
6061use crate :: {
@@ -125,6 +126,7 @@ async fn create_parquet_physical_plan(
125126 state : & dyn Session ,
126127 time_partition : Option < String > ,
127128) -> Result < Arc < dyn ExecutionPlan > , DataFusionError > {
129+ let _guard = span ! ( Level :: DEBUG , "Construct Physical Plan" ) ;
128130 // Convert filters to physical expressions if applicable
129131 let filters = filters
130132 . iter ( )
@@ -182,6 +184,7 @@ async fn create_parquet_physical_plan(
182184 Ok ( plan)
183185}
184186
187+ #[ instrument]
185188async fn collect_from_snapshot (
186189 snapshot : & catalog:: snapshot:: Snapshot ,
187190 time_filters : & [ PartialTimeFilter ] ,
@@ -332,6 +335,7 @@ impl TableProvider for StandardTableProvider {
332335 filters : & [ Expr ] ,
333336 limit : Option < usize > ,
334337 ) -> Result < Arc < dyn ExecutionPlan > , DataFusionError > {
338+ let _guard = span ! ( Level :: DEBUG , "Execution Plan Preparation" ) ;
335339 let mut memory_exec = None ;
336340 let mut cache_exec = None ;
337341 let mut hot_tier_exec = None ;
@@ -357,6 +361,7 @@ impl TableProvider for StandardTableProvider {
357361
358362 // Memory Execution Plan (for current stream data in memory)
359363 if include_now ( filters, time_partition. clone ( ) ) {
364+ let _guard = span ! ( Level :: DEBUG , "Memory Execution Plan Preparation" ) ;
360365 if let Some ( records) =
361366 event:: STREAM_WRITERS . recordbatches_cloned ( & self . stream , & self . schema )
362367 {
@@ -371,6 +376,7 @@ impl TableProvider for StandardTableProvider {
371376
372377 // Merged snapshot creation for query mode
373378 let merged_snapshot = if CONFIG . parseable . mode == Mode :: Query {
379+ let _guard = span ! ( Level :: DEBUG , "Merging snapshots" ) ;
374380 let path = RelativePathBuf :: from_iter ( [ & self . stream , STREAM_ROOT_DIRECTORY ] ) ;
375381 glob_storage
376382 . get_objects (
@@ -398,8 +404,8 @@ impl TableProvider for StandardTableProvider {
398404 let listing_time_fiters =
399405 return_listing_time_filters ( & merged_snapshot. manifest_list , & mut time_filters) ;
400406
401- listing_exec = if let Some ( listing_time_filter) = listing_time_fiters {
402- legacy_listing_table (
407+ if let Some ( listing_time_filter) = listing_time_fiters {
408+ listing_exec = legacy_listing_table (
403409 self . stream . clone ( ) ,
404410 glob_storage. clone ( ) ,
405411 object_store. clone ( ) ,
@@ -412,9 +418,7 @@ impl TableProvider for StandardTableProvider {
412418 time_partition. clone ( ) ,
413419 )
414420 . await ?
415- } else {
416- None
417- } ;
421+ }
418422 }
419423
420424 // Manifest file collection
@@ -545,6 +549,7 @@ async fn get_cache_exectuion_plan(
545549 state : & dyn Session ,
546550 time_partition : Option < String > ,
547551) -> Result < Option < Arc < dyn ExecutionPlan > > , DataFusionError > {
552+ let _guard = span ! ( Level :: DEBUG , "Construct Execution Plan against Cache" ) ;
548553 let ( cached, remainder) = cache_manager
549554 . partition_on_cached ( stream, manifest_files. clone ( ) , |file : & File | {
550555 & file. file_path
@@ -594,6 +599,7 @@ async fn get_hottier_exectuion_plan(
594599 state : & dyn Session ,
595600 time_partition : Option < String > ,
596601) -> Result < Option < Arc < dyn ExecutionPlan > > , DataFusionError > {
602+ let _guard = span ! ( Level :: DEBUG , "Execution Plan for Hot Tier" ) ;
597603 let ( hot_tier_files, remainder) = hot_tier_manager
598604 . get_hot_tier_manifest_files ( stream, manifest_files. clone ( ) )
599605 . await
@@ -646,6 +652,7 @@ async fn legacy_listing_table(
646652 limit : Option < usize > ,
647653 time_partition : Option < String > ,
648654) -> Result < Option < Arc < dyn ExecutionPlan > > , DataFusionError > {
655+ let _guard = span ! ( Level :: DEBUG , "Execution Plan for Legacy Listings" ) ;
649656 let remote_table = ListingTableBuilder :: new ( stream)
650657 . populate_via_listing ( glob_storage. clone ( ) , object_store, time_filters)
651658 . and_then ( |builder| async {
0 commit comments