@@ -233,53 +233,84 @@ def _render_structure(self) -> Group:
233233 if stats .has_distinct_count :
234234 has_distinct_count = True
235235
236- # Only show panels for indexes that are actually present
237- if has_col_index :
238- col_index_text = Text ()
239- col_index_text .append (
240- "Per-page statistics for filtering\n \n " , style = "cyan"
241- )
242- col_index_text .append ("Contains:\n " , style = "bold" )
243-
244- # Only list statistics that are actually present
245- if has_min_max :
246- col_index_text .append ("• min/max values per page\n " , style = "dim" )
247- if has_null_count :
248- col_index_text .append ("• null_count per page\n " , style = "dim" )
249- if has_distinct_count :
250- col_index_text .append ("• distinct_count per page\n " , style = "dim" )
251-
252- col_index_text .append ("• Enables page-level pruning" , style = "dim" )
253- col_index_panel = Panel (
254- col_index_text ,
255- title = "[magenta]Column Index[/magenta]" ,
256- border_style = "magenta" ,
257- )
258- page_index_panels .append (col_index_panel )
236+ # Create a single parent panel if any indexes exist
237+ if has_col_index or has_off_index :
238+ page_index_content : list [Text | Table ] = []
239+
240+ # Total size at the top
241+ size_text = Text ()
242+ size_text .append (f"Total Size: { page_index_size_str } " , style = "bold" )
243+ page_index_content .append (size_text )
244+ page_index_content .append (Text ()) # Blank line
245+
246+ # Create a table for the index sub-panels
247+ index_table = Table .grid (padding = (0 , 1 ), expand = True )
248+ index_table .add_column (ratio = 1 )
249+ index_table .add_column (ratio = 1 )
250+
251+ index_panels : list [Panel | Text ] = []
252+
253+ # Column Index sub-panel
254+ if has_col_index :
255+ col_index_text = Text ()
256+ col_index_text .append (
257+ "Per-page statistics for filtering\n \n " , style = "cyan"
258+ )
259+ col_index_text .append ("Contains:\n " , style = "bold" )
259260
260- if has_off_index :
261- offset_index_text = Text ()
262- offset_index_text .append (
263- "Page locations for random access\n \n " , style = "cyan"
264- )
265- offset_index_text .append ("Contains:\n " , style = "bold" )
266- offset_index_text .append ("• Page file offsets\n " , style = "dim" )
267- offset_index_text .append ("• compressed_page_size\n " , style = "dim" )
268- offset_index_text .append ("• first_row_index per page" , style = "dim" )
269- offset_index_panel = Panel (
270- offset_index_text ,
271- title = "[magenta]Offset Index[/magenta]" ,
272- border_style = "magenta" ,
273- )
274- page_index_panels .append (offset_index_panel )
261+ # Only list statistics that are actually present
262+ if has_min_max :
263+ col_index_text .append (
264+ "• min/max values per page\n " , style = "dim"
265+ )
266+ if has_null_count :
267+ col_index_text .append ("• null_count per page\n " , style = "dim" )
268+ if has_distinct_count :
269+ col_index_text .append (
270+ "• distinct_count per page\n " , style = "dim"
271+ )
275272
276- # Add total size info if we have both indexes
277- if has_col_index and has_off_index :
278- total_text = Text ()
279- total_text .append (
280- f"Total page indexes: { page_index_size_str } " , style = "dim"
273+ col_index_text .append ("• Enables page-level pruning" , style = "dim" )
274+ col_index_panel = Panel (
275+ col_index_text ,
276+ title = "[cyan]Column Index[/cyan]" ,
277+ border_style = "dim" ,
278+ padding = (0 , 1 ),
279+ )
280+ index_panels .append (col_index_panel )
281+ else :
282+ index_panels .append (Text ("" ))
283+
284+ # Offset Index sub-panel
285+ if has_off_index :
286+ offset_index_text = Text ()
287+ offset_index_text .append (
288+ "Page locations for random access\n \n " , style = "cyan"
289+ )
290+ offset_index_text .append ("Contains:\n " , style = "bold" )
291+ offset_index_text .append ("• Page file offsets\n " , style = "dim" )
292+ offset_index_text .append ("• compressed_page_size\n " , style = "dim" )
293+ offset_index_text .append ("• first_row_index per page" , style = "dim" )
294+ offset_index_panel = Panel (
295+ offset_index_text ,
296+ title = "[cyan]Offset Index[/cyan]" ,
297+ border_style = "dim" ,
298+ padding = (0 , 1 ),
299+ )
300+ index_panels .append (offset_index_panel )
301+ else :
302+ index_panels .append (Text ("" ))
303+
304+ index_table .add_row (* index_panels )
305+ page_index_content .append (index_table )
306+
307+ # Create the parent panel
308+ page_index_panel = Panel (
309+ Group (* page_index_content ),
310+ title = "[magenta]Page Indexes[/magenta]" ,
311+ border_style = "magenta" ,
281312 )
282- page_index_panels .append (total_text )
313+ page_index_panels .append (page_index_panel )
283314
284315 # Footer metadata
285316 metadata_size_str = self ._format_size (self .reader .metadata_size )
0 commit comments