{"record":{"id":"3760fc5d164c830e","repo":"pola-rs/polars","slug":"n-rows-cannot-be-used-with-use-pyarrow-true","errorCode":null,"errorMessage":"`n_rows` cannot be used with `use_pyarrow=True`","messagePattern":"`n_rows` 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":245,"sourceCode":"\n    \"\"\"\n    row_index = parse_row_index_args(row_index_name, row_index_offset)\n    del row_index_name\n    del row_index_offset\n\n    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,","sourceCodeStart":227,"sourceCodeEnd":263,"githubUrl":"https://github.com/pola-rs/polars/blob/fe841f959ef4d2ceefc05a310d33ed7b1ab24e5e/py-polars/src/polars/io/parquet/functions.py#L227-L263","documentation":"When read_parquet is dispatched to pyarrow (use_pyarrow=True), the row-limit parameter n_rows is not honored by the pyarrow path, so Polars rejects the combination with a ValueError instead of silently ignoring the limit.","triggerScenarios":"pl.read_parquet(..., use_pyarrow=True, n_rows=<int>) — any non-None n_rows together with use_pyarrow=True.","commonSituations":"Code that adds use_pyarrow=True for compatibility while already limiting rows; debugging memory issues by adding a row cap to an existing pyarrow-dispatched read.","solutions":["Drop n_rows and rely on pyarrow_options (e.g. pyarrow_options={'filters': ...}) if applicable","Remove use_pyarrow=True so Polars' native reader honors n_rows","Use pl.scan_parquet(...).head(n).collect() to limit rows natively"],"exampleFix":"// before\npl.read_parquet('f.parquet', n_rows=100, use_pyarrow=True)\n// after\npl.read_parquet('f.parquet', n_rows=100)","handlingStrategy":"validation","validationCode":"if use_pyarrow and n_rows is not None:\n    raise ValueError('n_rows cannot be used with use_pyarrow=True')","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Audit pyarrow-dispatch calls for native-only params (n_rows, include_file_paths, schema, hive_schema)","Use scan_parquet(...).head(n).collect() for row limits","Centralize read_parquet wrappers to enforce option combinations"],"tags":["polars","parquet","pyarrow"],"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"}