{"record":{"id":"3250a3395cc823fa","repo":"pola-rs/polars","slug":"collect-all-async-is-not-supported-by-type-self","errorCode":null,"errorMessage":"`collect_all_async` is not supported by {type(self).__name__}","messagePattern":"`collect_all_async` is not supported by (.+?)","errorType":"exception","errorClass":"NotImplementedError","httpStatus":null,"severity":"error","filePath":"py-polars/src/polars/lazyframe/engine.py","lineNumber":222,"sourceCode":"        raise NotImplementedError(msg)\n\n    def collect_all(\n        self, lfs: Iterable[LazyFrame], *, optimizations: QueryOptFlags\n    ) -> list[DataFrame]:\n        \"\"\"Execute several queries, potentially in parallel.\"\"\"\n        msg = f\"`collect_all` is not supported by {type(self).__name__}\"\n        raise NotImplementedError(msg)\n\n    def collect_all_async(\n        self,\n        lfs: Iterable[LazyFrame],\n        *,\n        optimizations: QueryOptFlags,\n        gevent: bool = False,\n    ) -> AsyncResult[list[DataFrame]]:\n        \"\"\"Execute several queries asynchronously.\"\"\"\n        msg = f\"`collect_all_async` is not supported by {type(self).__name__}\"\n        raise NotImplementedError(msg)\n\n    def sink_parquet(\n        self,\n        lf: LazyFrame,\n        path: str | Path | IO[bytes] | PartitionBy,\n        *,\n        compression: ParquetCompression,\n        compression_level: int | None,\n        statistics: bool | str | dict[str, bool],\n        row_group_size: int | None,\n        data_page_size: int | None,\n        maintain_order: bool,\n        storage_options: StorageOptionsDict | None,\n        credential_provider: CredentialProviderFunction | Literal[\"auto\"] | None,\n        retries: int | None,\n        sync_on_close: SyncOnCloseMethod | None,\n        metadata: ParquetMetadata | None,\n        arrow_schema: ArrowSchemaExportable | None,","sourceCodeStart":204,"sourceCodeEnd":240,"githubUrl":"https://github.com/pola-rs/polars/blob/df599052daf96e7a9cc30a3b0c6bd25d6947e3c0/py-polars/src/polars/lazyframe/engine.py#L204-L240","documentation":"`Engine.collect_all_async` (engine.py:222) is the optional asynchronous variant of `collect_all` used by `pl.collect_all_async`; its default stub raises `NotImplementedError` with the engine class name. As with the other optional hooks, only the local engine family implements it, so `RemoteEngine` and minimal custom `Engine` subclasses reject it.","triggerScenarios":"`pl.collect_all_async([lf1, lf2], engine=pl.RemoteEngine())` or the same with a custom engine lacking the override. Also reached when a gevent/async orchestration layer routes every query through `collect_all_async` while a non-local engine affinity is active.","commonSituations":"Server code that awaits many queries concurrently and is pointed at Polars Cloud by configuration; test harnesses with a fake engine implementing only the abstract methods; version upgrades where code that previously used only local engines now accepts arbitrary engine objects.","solutions":["Use a local engine: `pl.collect_all_async(lfs, engine='streaming')`","Fall back to per-query background handles: `handles = [lf.collect(engine=remote, background=True) for lf in lfs]` then `fetch()` each","Implement `collect_all_async` on your custom `Engine` subclass","Feature-detect support before calling (see defense) and choose the sync path otherwise"],"exampleFix":"# before\nres = pl.collect_all_async([lf1], engine=pl.RemoteEngine())  # NotImplementedError\n\n# after\nhandles = [lf1.collect(engine=remote, background=True)]\ndfs = [h.fetch() for h in handles]","handlingStrategy":"validation","validationCode":"from polars.lazyframe.engine import Engine\n\ndef supports_collect_all_async(engine: pl.Engine) -> bool:\n    return type(engine).collect_all_async is not Engine.collect_all_async\n\nif not supports_collect_all_async(engine):\n    handles = [lf.collect(engine=engine, background=True) for lf in lfs]\n    dfs = [h.fetch() for h in handles]","typeGuard":null,"tryCatchPattern":"try:\n    ar = pl.collect_all_async(lfs, engine=engine)\nexcept NotImplementedError:\n    handles = [lf.collect(engine=engine, background=True) for lf in lfs]","preventionTips":["Use background=True handles as the engine-agnostic async mechanism","Reserve collect_all_async for known-local engines","Assert engine capabilities in integration tests for every supported backend"],"tags":["polars","engine","async","multi-query","not-implemented"],"backgroundTag":null,"analyzedSha":"df599052daf96e7a9cc30a3b0c6bd25d6947e3c0","analyzedAt":"2026-08-16T12:10:03.978Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}