brayanjuls commented on issue #9081:
URL:
https://github.com/apache/arrow-datafusion/issues/9081#issuecomment-1925948468
@l45k @alamb I was able to reproduce the issue and also checked the unit
test used in Datafusion to test this functionality and I notice a different
approach to get the schema with metadata. It seems that you are able to get the
metadata only after collecting the DataFrame, so for example the following
works.
```rust
use datafusion::prelude::*;
#[tokio::main]
async fn main(){
let ctx = SessionContext::new();
ctx.register_parquet("ta", "test.parquet",
ParquetReadOptions::default().skip_metadata(false)).await.unwrap();
let df = ctx.table("ta").await.unwrap();
let batches = df.collect().await.unwrap();
for batch in &batches{
println!("Schema {:?}", batch.schema());
println!("Metadata {:?}", batch.schema().metadata());
}
}
```
output:
```
Schema Schema { fields: [Field { name: "col1", data_type: Int64, nullable:
true, dict_id: 0, dict_is_ordered: false, metadata: {} }], metadata: {"col1":
"Some metadata"} }
Metadata {"col1": "Some metadata"}
```
I am still investigating if it make sense to be able to access the metadata
after collecting the DataFrame.
--
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]