pola-rs/polars · error · TypeError
cannot use `hive_partitions` with `use_pyarrow=True` Hint…
Error message
cannot use `hive_partitions` with `use_pyarrow=True` Hint: Pass `pyarrow_options` instead with a 'partitioning' entry.
What it means
hive_partitions (with hive_schema) is a native-reader feature for expanding hive-style partition directories into columns. The pyarrow dispatch path does not support it; users must instead supply pyarrow's own partitioning option via pyarrow_options. Polars raises a TypeError with a hint to that effect.
Solutions
- Pass pyarrow_options={'partitioning': 'hive'} (or a pyarrow.partitioning schema) instead of hive_schema
- Remove use_pyarrow=True so the native reader handles hive partitions via hive_schema
- Drop hive_schema entirely if partition columns are not needed
Example fix
// before
pl.read_parquet('s3://bucket/ds/', use_pyarrow=True, hive_schema={'date': pl.Date})
// after
pl.read_parquet('s3://bucket/ds/', use_pyarrow=True, pyarrow_options={'partitioning': 'hive'}) Defensive patterns
Strategy: validation
Validate before calling
if use_pyarrow and hive_schema is not None:
raise ValueError('use pyarrow_options={"partitioning": "hive"} instead of hive_schema') Try / catch
try:
df = pl.read_parquet(path, use_pyarrow=True, hive_schema=hs)
except TypeError:
df = pl.read_parquet(path, use_pyarrow=True, pyarrow_options={'partitioning': 'hive'}) Prevention
- For pyarrow dispatch, express hive partitioning via pyarrow_options
- Reserve hive_schema for the native reader
- Test hive reads on both backends when toggling use_pyarrow
When it happens
Trigger: pl.read_parquet(..., use_pyarrow=True, hive_schema=...) on a hive-partitioned dataset.
Common situations: Reading hive-partitioned datasets from S3/cloud while forcing pyarrow; switching use_pyarrow=True on without removing hive options.
Understand the failure class
Background: Conflicting config options: "cannot be used together" — configuration validation errors across open-source libraries — this error's family across 162 libraries.
Related errors
- `include_file_paths` cannot be used with `use_pyarrow=True`
- `n_rows` cannot be used with `use_pyarrow=True`
- `schema` cannot be used with `use_pyarrow=True`
- cannot parse Python data type
- `df` of type does not support the dataframe interchange…
AI-assisted analysis of pola-rs/polars@fe841f959e (2026-09-18).
Data as JSON: /api/errors/ac345135a6d0fdf8.
Report an issue: GitHub.
Appendix: source
Thrown at py-polars/src/polars/io/parquet/functions.py:257
issue_unstable_warning(msg)
# Dispatch to pyarrow if requested
if use_pyarrow:
if n_rows is not None:
msg = "`n_rows` cannot be used with `use_pyarrow=True`"
raise ValueError(msg)
if include_file_paths is not None:
msg = "`include_file_paths` cannot be used with `use_pyarrow=True`"
raise ValueError(msg)
if schema is not None:
msg = "`schema` cannot be used with `use_pyarrow=True`"
raise ValueError(msg)
if hive_schema is not None:
msg = (
"cannot use `hive_partitions` with `use_pyarrow=True`"
"\n\nHint: Pass `pyarrow_options` instead with a 'partitioning' entry."
)
raise TypeError(msg)
df = _read_parquet_with_pyarrow(
source,
columns=columns,
storage_options=storage_options,
pyarrow_options=pyarrow_options,
memory_map=memory_map,
)
if row_index is not None:
name, offset = row_index
df = df.with_row_index(name, offset)
return df
# For other inputs, defer to `scan_parquet`
lf = scan_parquet(
source,View on GitHub (pinned to fe841f959e)