ZENOTME commented on issue #1202:
URL: https://github.com/apache/iceberg-rust/issues/1202#issuecomment-2798502790
Hi @hugokitano, seems this example uses the map type in the wrong way.
```
// Create the key_value field with metadata
let mut key_value_metadata = HashMap::new();
key_value_metadata.insert(PARQUET_FIELD_ID_META_KEY.to_string(),
"3".to_string());
let key_value_field = Field::new(
"struct",
arrow_schema::DataType::Struct(vec![
Arc::new(key_field.clone()),
Arc::new(value_field.clone()),
].into()),
false
).with_metadata(key_value_metadata.clone());
```
should be
```
// Create the key_value field with metadata
// let mut key_value_metadata = HashMap::new();
// key_value_metadata.insert(PARQUET_FIELD_ID_META_KEY.to_string(),
"3".to_string());
let key_value_field = Field::new(
DEFAULT_MAP_FIELD_NAME,
arrow_schema::DataType::Struct(vec![
Arc::new(key_field.clone()),
Arc::new(value_field.clone()),
].into()),
false
);
```
In iceberg, it doesn't have the concept of key_value field I think. This
field is used for the arrow to represent map array(Because it represent map as
array of struct):
1. The key value field name should be "key_value".
2. key value field don't need to have field id.
--
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]