pshampanier opened a new issue, #6700:
URL: https://github.com/apache/arrow-rs/issues/6700
**Describe the bug**
When calling `arrow_integration_test::schema_to_json(schema)` metadata at
the field level are not serialized.
**To Reproduce**
```rust
#[cfg(test)]
mod tests {
use arrow_integration_test::schema_to_json;
use arrow_schema::{DataType, Field, Schema};
use std::collections::HashMap;
#[test]
fn test_schema_to_json() {
let metadata = [("key1".to_string(),
"value1".to_string())].iter().cloned().collect::<HashMap<_, _>>();
let fields = vec![Field::new("a", DataType::Int32,
true).with_metadata(metadata.clone())];
let schema = Schema::new(fields).with_metadata(metadata.clone());
let json = schema_to_json(&schema);
assert_eq!(
serde_json::to_string_pretty(&json).unwrap(),
serde_json::to_string_pretty(&serde_json::json!({
"fields": [
{
"name": "a",
"nullable": true,
"type": {
"bitWidth": 32,
"isSigned": true,
"name": "int"
},
"children": [],
"metadata": {
"key1": "value1"
},
},
],
"metadata": {
"key1": "value1"
},
}))
.unwrap()
);
}
}
```
**Expected behavior**
Expected:
```json
{
"fields": [
{
"children": [],
"metadata": {
"key1": "value1"
},
"name": "a",
"nullable": true,
"type": {
"bitWidth": 32,
"isSigned": true,
"name": "int"
}
}
],
"metadata": {
"key1": "value1"
}
}
```
Found:
```json
{
"fields": [
{
"children": [],
"name": "a",
"nullable": true,
"type": {
"bitWidth": 32,
"isSigned": true,
"name": "int"
}
}
],
"metadata": {
"key1": "value1"
}
}
```
The `metadata` key is available at the schema level but missing for fields.
**Additional context**
Tested with `arrow version = "53.1.0"`
--
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]