JingsongLi commented on code in PR #1469:
URL: https://github.com/apache/paimon-rust/pull/1469#discussion_r4674590546


##########
crates/paimon/src/arrow/format/parquet.rs:
##########
@@ -88,9 +130,110 @@ impl ParquetFormatReader {
             page_index_enabled: 
core_options.parquet_filter_column_index_enabled()?,
             // Format-table files may be replaced in place.
             metadata_cache_enabled: !core_options.is_format_table(),
+            merged_metadata: None,
+        })
+    }
+
+    pub(crate) fn with_merged_read_metadata(mut self, metadata: 
MergedReadMetadata) -> Self {
+        self.merged_metadata = Some(metadata);
+        self
+    }
+
+    fn reader_options(&self, has_predicate: bool, has_selection: bool) -> 
ArrowReaderOptions {
+        let mut options = ArrowReaderOptions::new();
+        if self.page_index_enabled {
+            if has_predicate {
+                options = 
options.with_column_index_policy(PageIndexPolicy::Optional);
+            }
+            if has_predicate || has_selection {
+                options = 
options.with_offset_index_policy(PageIndexPolicy::Optional);
+            }
+        }
+        options
+    }
+
+    pub(crate) async fn load_merged_read_metadata(
+        &self,
+        reader: Box<dyn FileRead>,
+        file_size: u64,
+        selected_filter: Option<SelectedRowsFilter<'_>>,
+    ) -> parquet::errors::Result<MergedReadMetadata> {
+        let mut reader = ArrowFileReader::new(file_size, reader.into())
+            .with_metadata_cache_enabled(self.metadata_cache_enabled);
+        let mut fetch = ParquetMetadataFetch::new(&mut reader);
+        let row_group_match = match selected_filter.as_ref().filter(|_| 
self.page_index_enabled) {
+            Some(filter) => 
selected_row_group_match(fetch.load(None).await?.as_ref(), filter),
+            None => RowGroupMatch::Unknown,
+        };
+        let options = self.reader_options(
+            row_group_match == RowGroupMatch::Unknown,

Review Comment:
   **[P2] Keep offset-only reads for an already selected point when the footer 
is inconclusive**
   
   If the footer cannot decide the predicate for the whole row group, this 
still fetches the full `ColumnIndex`. Candidate selection also enables 
projected page-row verification even when it keeps exactly the caller’s 
existing row. On the PR’s 100,000-row fixture with a 49-column rating provider 
and 64 rows per page, I requested only `_ROW_ID = 102117` and used `rating >= 
2117`. Both settings returned the same single row. With pruning enabled, cold 
read bytes rose from 1,939,935 to 3,159,015, and column-data bytes rose from 
450 to 3,595. The earlier footer-decidable cases still pass. Consider keeping 
the offset-only path for very small explicit selections when the footer is 
inconclusive and letting the residual check those rows.



-- 
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]

Reply via email to