pdstools.explanations.Schema

Expected schema of the pre-aggregated explanations parquet files.

Attributes

AGGREGATE_SCHEMA

Columns read from OVERVIEW.parquet / BY_CONTEXT.parquet, and the

Functions

apply_schema(→ polars.LazyFrame)

Select the expected columns from lf and cast them to their dtypes.

Module Contents

AGGREGATE_SCHEMA: dict[str, polars.DataType]

Columns read from OVERVIEW.parquet / BY_CONTEXT.parquet, and the dtype each is cast to. Casting on read means every downstream aggregation sees the same types regardless of how the exporting Pega version wrote the file.

apply_schema(lf: polars.LazyFrame) polars.LazyFrame

Select the expected columns from lf and cast them to their dtypes.

Parameters:

lf (pl.LazyFrame) – Scan over one of the aggregated parquet files.

Returns:

lf narrowed to AGGREGATE_SCHEMA and cast to its dtypes.

Return type:

pl.LazyFrame

Raises:

ValueError – If lf is missing any of the expected columns.