You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "mapleFU (via GitHub)" <gi...@apache.org> on 2025/10/24 02:14:03 UTC

[D] How to get Parquet's SchemaDescriptor when using parquet ArrowWriter? [arrow-rs]

GitHub user mapleFU created a discussion: How to get Parquet's SchemaDescriptor when using parquet ArrowWriter?

I'm using parquet ArrowWriter. And during closing metadata, I may need to get a SchemaDescriptor to analyze the min-max metadata statistics. How could I get the descriptor? Or should I use `FileMetaData::schema` to analyze statistics in `FileMetadata` when `finish()` or `close()` called?

GitHub link: https://github.com/apache/arrow-rs/discussions/8705

----
This is an automatically sent email for github@arrow.apache.org.
To unsubscribe, please send an email to: github-unsubscribe@arrow.apache.org


Re: [D] How to get Parquet's SchemaDescriptor when using parquet ArrowWriter? [arrow-rs]

Posted by "Jefffrey (via GitHub)" <gi...@apache.org>.
GitHub user Jefffrey added a comment to the discussion: How to get Parquet's SchemaDescriptor when using parquet ArrowWriter?

@mapleFU are you still looking for an answer to this or you figured it out?

GitHub link: https://github.com/apache/arrow-rs/discussions/8705#discussioncomment-17819565

----
This is an automatically sent email for github@arrow.apache.org.
To unsubscribe, please send an email to: github-unsubscribe@arrow.apache.org


Re: [D] How to get Parquet's SchemaDescriptor when using parquet ArrowWriter? [arrow-rs]

Posted by "mapleFU (via GitHub)" <gi...@apache.org>.
GitHub user mapleFU added a comment to the discussion: How to get Parquet's SchemaDescriptor when using parquet ArrowWriter?

Seems that this interface is added later, would close this

GitHub link: https://github.com/apache/arrow-rs/discussions/8705#discussioncomment-17820535

----
This is an automatically sent email for github@arrow.apache.org.
To unsubscribe, please send an email to: github-unsubscribe@arrow.apache.org


Re: [D] How to get Parquet's SchemaDescriptor when using parquet ArrowWriter? [arrow-rs]

Posted by "ryux1 (via GitHub)" <gi...@apache.org>.
GitHub user ryux1 closed the discussion with a comment: How to get Parquet's SchemaDescriptor when using parquet ArrowWriter?

`ArrowWriter::finish()` (or `close()`) returns `ParquetMetaData`, so you can get the descriptor from its file metadata directly. You do not need to reconstruct it from the Thrift `schema` field.

```rust
let metadata = writer.finish()?;
let schema = metadata.file_metadata().schema_descr();

for row_group in metadata.row_groups() {
    for (i, column) in row_group.columns().iter().enumerate() {
        let descriptor = schema.column(i);

        if let Some(statistics) = column.statistics() {
            println!("{}: {statistics:?}", descriptor.path());
            // Match on `statistics` here if you need typed min/max values.
        }
    }
}
```

The column index here is the Parquet physical leaf-column index, which is why iterating `row_group.columns()` and looking up `schema.column(i)` is preferable to indexing by top-level Arrow fields.

If you need metadata before finishing, `writer.flushed_row_groups()` exposes only row groups that have already been flushed; each `RowGroupMetaData` also has `schema_descr()`. For complete file metadata, use the value returned by `finish()`/`close()`.

I checked this against Arrow Rust 57.0.0 (the release current when this question was opened) with a small compiling writer example. Disclosure: I used OpenAI Codex to help inspect the relevant APIs and validate the example.


GitHub link: https://github.com/apache/arrow-rs/discussions/8705#discussioncomment-18340597

----
This is an automatically sent email for github@arrow.apache.org.
To unsubscribe, please send an email to: github-unsubscribe@arrow.apache.org


Re: [D] How to get Parquet's SchemaDescriptor when using parquet ArrowWriter? [arrow-rs]

Posted by "mapleFU (via GitHub)" <gi...@apache.org>.
GitHub user mapleFU closed a discussion: How to get Parquet's SchemaDescriptor when using parquet ArrowWriter?

I'm using parquet ArrowWriter. And during closing metadata, I may need to get a SchemaDescriptor to analyze the min-max metadata statistics. How could I get the descriptor? Or should I use `FileMetaData::schema` to analyze statistics in `FileMetadata` when `finish()` or `close()` called?

GitHub link: https://github.com/apache/arrow-rs/discussions/8705

----
This is an automatically sent email for github@arrow.apache.org.
To unsubscribe, please send an email to: github-unsubscribe@arrow.apache.org