kamcheungting-db commented on code in PR #3242:
URL: https://github.com/apache/iceberg-rust/pull/3242#discussion_r4142011027


##########
crates/iceberg/src/arrow/reader/pipeline.rs:
##########
@@ -723,6 +635,65 @@ impl FileScanTaskReader {
         Ok(Box::pin(record_batch_stream) as ArrowRecordBatchStream)
     }
 
+    /// Applies all task-specific schema and virtual-column options, 
rebuilding the
+    /// Arrow reader metadata at most once.
+    fn configure_arrow_reader_metadata(
+        arrow_metadata: ArrowReaderMetadata,
+        task: &FileScanTask,
+        missing_field_ids: bool,
+        install_row_number: bool,
+    ) -> Result<ArrowReaderMetadata> {
+        // Three-branch schema resolution strategy matching Java's ReadConf 
constructor.
+        // When Parquet files lack field IDs, apply a name mapping when 
available and use
+        // position-based fallback IDs otherwise. Files with embedded IDs keep 
their schema.
+        let mut arrow_schema = if missing_field_ids {
+            if let Some(name_mapping) = task.name_mapping() {
+                apply_name_mapping_to_arrow_schema(
+                    Arc::clone(arrow_metadata.schema()),
+                    name_mapping,
+                )?
+            } else {
+                add_fallback_field_ids_to_arrow_schema(arrow_metadata.schema())
+            }
+        } else {
+            Arc::clone(arrow_metadata.schema())

Review Comment:
   Done



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