polars::prelude

Function infer_schema

pub fn infer_schema(
    file_metadata: &FileMetadata,
) -> Result<Schema<Field>, PolarsError>
Available on crate feature polars-io only.
Expand description

Infers a ArrowSchema from parquet’s FileMetadata.

This first looks for the metadata key "ARROW:schema"; if it does not exist, it converts the Parquet types declared in the file’s Parquet schema to Arrow’s equivalent.

§Error

This function errors iff the key "ARROW:schema" exists but is not correctly encoded, indicating that the file’s arrow metadata was incorrectly written.