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/04/10 01:00:09 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_r3061463355


##########
crates/iceberg/src/avro/schema.rs:
##########
@@ -220,6 +221,39 @@ impl SchemaVisitor for SchemaToAvroSchema {
         }
     }
 
+    fn variant(&mut self, _v: &VariantType) -> Result<AvroSchemaOrField> {
+        let fields = vec![
+            AvroRecordField {
+                name: "metadata".to_string(),
+                schema: AvroSchema::Bytes,
+                order: RecordFieldOrder::Ignore,
+                position: 0,
+                doc: None,
+                aliases: None,
+                default: None,
+                custom_attributes: Default::default(),
+            },
+            AvroRecordField {
+                name: "value".to_string(),
+                schema: AvroSchema::Bytes,
+                order: RecordFieldOrder::Ignore,
+                position: 1,
+                doc: None,
+                aliases: None,
+                default: None,
+                custom_attributes: Default::default(),
+            },
+        ];

Review Comment:
   Would you use `LazyLock<Vec<AvroRecordField>>` plus clone? `avro_record_schema` consumes the Vec<AvroRecordField> by value (it builds a RecordSchema), so each call needs its own owned copy regardless. Not sure if this would gain much. 



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