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 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

  • 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.