alamb opened a new pull request, #24150:
URL: https://github.com/apache/datafusion/pull/24150

   ## Which issue does this PR close?
   
   - Part of #24149
   
   ## Rationale for this change
   
   Profiling ClickBench Q24 in #24149 showed almost 10% of query time spent 
cloning `ParquetMetaData`. When a page pruning predicate exists, the opener 
tries to load the page index by deep-cloning the `ParquetMetaData` (the `Arc` 
is also held by the metadata cache, so `Arc::try_unwrap` always fails) and 
handing it to `ParquetMetaDataReader`. For files that have no page index at all 
(such as the ClickBench `hits` files), the reader then discovers there is 
nothing to load and the clone was pure waste — paid on every file open.
   
   The footer metadata already records the column/offset index locations 
(`ColumnChunkMetaData::column_index_offset()` / `offset_index_offset()`) even 
when the index itself has not been read, so we can determine that a load can 
never succeed without any I/O or cloning.
   
   ## What changes are included in this PR?
   
   - Add `file_has_page_index` which checks the column chunk metadata for 
recorded column/offset index offsets
   - Only attempt to load the page index (which requires cloning the 
`ParquetMetaData`) when the file actually has one
   
   ## Are these changes tested?
   
   New unit test `test_file_has_page_index`, plus existing coverage: page index 
behavior is exercised by the existing `datasource-parquet` unit tests and the 
parquet sqllogictests. Benchmark results (ClickBench Q24) to follow in the 
comments.
   
   ## Are there any user-facing changes?
   
   No, this is a performance optimization only.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to