c-thiel commented on code in PR #2188:
URL: https://github.com/apache/iceberg-rust/pull/2188#discussion_r2871247953


##########
crates/integrations/datafusion/src/schema.rs:
##########
@@ -163,10 +164,14 @@ impl SchemaProvider for IcebergSchemaProvider {
         let iceberg_schema = 
arrow_schema_to_schema_auto_assign_ids(df_schema.as_ref())
             .map_err(to_datafusion_error)?;
 
+        // Use at least V2, and upgrade to V3 if the schema requires it (e.g. 
timestamp_ns / variant).
+        let format_version = 
iceberg_schema.min_format_version().max(FormatVersion::V2);
+
         // Create the table in the Iceberg catalog
         let table_creation = TableCreation::builder()
             .name(name.clone())
             .schema(iceberg_schema)
+            .format_version(format_version)

Review Comment:
   The previous tests that we had where wrong as they where creating a V2 table 
with Nanosecond Timestamp resolution:
   
https://github.com/apache/iceberg-rust/actions/runs/22522306915/job/65248930667
   
   This new logic determines the min format version required and uses that - 
but at least V2. Thus we switch now to V3 for ns timestamps.



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