You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@iceberg.apache.org by "c-thiel (via GitHub)" <gi...@apache.org> on 2026/03/02 09:00:07 UTC

Re: [PR] feat: Variant Support [iceberg-rust]

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: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org