JanKaul commented on code in PR #82:
URL: https://github.com/apache/iceberg-rust/pull/82#discussion_r1392082466


##########
crates/iceberg/src/avro/schema.rs:
##########
@@ -233,23 +222,46 @@ pub(crate) fn schema_to_avro_schema(name: impl ToString, 
schema: &Schema) -> Res
     visit_schema(schema, &mut converter).map(Either::unwrap_left)
 }
 
-pub(crate) fn avro_fixed_schema(len: usize) -> Result<AvroSchema> {
+fn avro_record_schema(name: &str, fields: Vec<AvroRecordField>) -> 
Result<AvroSchema> {
+    let lookup = fields
+        .iter()
+        .enumerate()
+        .map(|f| (f.1.name.clone(), f.0))
+        .collect();
+
+    Ok(AvroSchema::Record(RecordSchema {
+        name: Name::new(name)?,
+        aliases: None,
+        doc: None,
+        fields,
+        lookup,
+        attributes: Default::default(),
+    }))
+}
+
+pub(crate) fn avro_fixed_schema(len: usize, logical_type: Option<&str>) -> 
Result<AvroSchema> {
+    let attributes = if let Some(logical_type) = logical_type {
+        BTreeMap::from([(
+            LOGICAL_TYPE.to_string(),
+            Value::String(logical_type.to_string()),
+        )])

Review Comment:
   This sometimes comes up if you want the value to be hashable. `BTreeMap` is 
hashable while `HashMap` is not hashable. I think it has something to do with 
requiring an order to be hashable.



-- 
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-unsubscr...@iceberg.apache.org

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


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

Reply via email to