{"record":{"id":"02c15c4be60927b7","repo":"pola-rs/polars","slug":"schema-cannot-be-used-with-use-pyarrow-true","errorCode":null,"errorMessage":"`schema` cannot be used with `use_pyarrow=True`","messagePattern":"`schema` cannot be used with `use_pyarrow=True`","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"py-polars/src/polars/io/parquet/functions.py","lineNumber":251,"sourceCode":"    if schema is not None:\n        msg = \"the `schema` parameter of `read_parquet` is considered unstable.\"\n        issue_unstable_warning(msg)\n\n    if hive_schema is not None:\n        msg = \"the `hive_schema` parameter of `read_parquet` is considered unstable.\"\n        issue_unstable_warning(msg)\n\n    # Dispatch to pyarrow if requested\n    if use_pyarrow:\n        if n_rows is not None:\n            msg = \"`n_rows` cannot be used with `use_pyarrow=True`\"\n            raise ValueError(msg)\n        if include_file_paths is not None:\n            msg = \"`include_file_paths` cannot be used with `use_pyarrow=True`\"\n            raise ValueError(msg)\n        if schema is not None:\n            msg = \"`schema` cannot be used with `use_pyarrow=True`\"\n            raise ValueError(msg)\n        if hive_schema is not None:\n            msg = (\n                \"cannot use `hive_partitions` with `use_pyarrow=True`\"\n                \"\\n\\nHint: Pass `pyarrow_options` instead with a 'partitioning' entry.\"\n            )\n            raise TypeError(msg)\n\n        df = _read_parquet_with_pyarrow(\n            source,\n            columns=columns,\n            storage_options=storage_options,\n            pyarrow_options=pyarrow_options,\n            memory_map=memory_map,\n        )\n\n        if row_index is not None:\n            name, offset = row_index\n            df = df.with_row_index(name, offset)","sourceCodeStart":233,"sourceCodeEnd":269,"githubUrl":"https://github.com/pola-rs/polars/blob/fe841f959ef4d2ceefc05a310d33ed7b1ab24e5e/py-polars/src/polars/io/parquet/functions.py#L233-L269","documentation":"An explicit schema parameter is only supported by Polars' native parquet reader; when use_pyarrow=True the read is delegated to pyarrow, which has no equivalent hook in this dispatch path, so passing schema triggers a ValueError.","triggerScenarios":"pl.read_parquet(..., use_pyarrow=True, schema=<Schema>) — any non-None schema combined with use_pyarrow=True.","commonSituations":"Overriding/upcasting column dtypes at read time while also dispatching to pyarrow; code migrated from native reads that added use_pyarrow=True later.","solutions":["Remove schema when using use_pyarrow=True","Drop use_pyarrow=True and keep the explicit schema","Cast after reading: df.cast(schema) or df.with_columns(...) post-read"],"exampleFix":"// before\npl.read_parquet('f.parquet', use_pyarrow=True, schema=myschema)\n// after\npl.read_parquet('f.parquet', schema=myschema)","handlingStrategy":"validation","validationCode":"if use_pyarrow and schema is not None:\n    raise ValueError('schema cannot be used with use_pyarrow=True')","typeGuard":null,"tryCatchPattern":"try:\n    df = pl.read_parquet(src, use_pyarrow=True, schema=s)\nexcept ValueError:\n    df = pl.read_parquet(src, schema=s)  # native path honors schema","preventionTips":["Apply schema overrides only on the native reader, or cast after read","Document that schema is incompatible with pyarrow dispatch","Validate option combos in a shared helper"],"tags":["polars","parquet","pyarrow","schema"],"backgroundTag":"conflicting-config-options","analyzedSha":"fe841f959ef4d2ceefc05a310d33ed7b1ab24e5e","analyzedAt":"2026-09-18T22:14:11.667Z","contentChangedAt":"2026-09-18T22:14:11.667Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}