Skip to main content

infer_schema

Function infer_schema 

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

Infers a ArrowSchema from parquet’s FileMetadata.

This converts the Parquet types declared in the file’s Parquet schema to Arrow’s equivalent. The Arrow schema stored under the metadata key "ARROW:schema", if any, adds what the Parquet types cannot express, such as time zones and categorical types.

§Error

  • Errors if the key "ARROW:schema" exists but is not correctly encoded.
  • Errors if the parquet schema contains duplicate top-level column names, since the resulting ArrowSchema cannot represent them.