Skip to content

[PERF]: Reuse sampled parquet footers from statistics collection #23853

Description

@Matt711

Statistics collection fetches footers for up to max_footer_samples (default 3) files, but only
stores them in ParquetSourceInfo.cached_parquet_info when all files were sampled:

@functools.cache
def _build_parquet_source(
paths: tuple[str, ...],
needed_cols: frozenset[str],
schema: tuple[tuple[str, DataType], ...],
max_footer_samples: int,
max_row_group_samples: int,
) -> ParquetSourceInfo:
"""Return cached, fully-computed Parquet datasource information."""
return ParquetSourceInfo.from_paths(
paths, needed_cols, schema, max_footer_samples, max_row_group_samples
)

So prefetch_parquet_file_metadata_for_ir re-fetches those same footers:

cached_parquet_info: dict[str, CachedParquetInfo] = {}
if stats is not None:
for node, datasource_info in stats.scan_stats.items():
if (
isinstance(node, Scan)
and node.typ == "parquet"
and isinstance(datasource_info, ParquetSourceInfo)
and datasource_info.cached_parquet_info is not None
):
for info in datasource_info.cached_parquet_info:
cached_parquet_info[info.path] = info
missing_paths = all_paths - set(cached_parquet_info.keys())

Related

Metadata

Metadata

Assignees

Labels

PerformancePerformance related issuecudf-polarsIssues specific to cudf-polars

Type

No type

Projects

Status
No status
Status
Todo

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions