在 LazyFrame 上使用 py-polars sink_parquet 方法时出现问题

Nil*_*dri 8 parquet python-polars

在 LazyFrame 上使用 sink_parquet 时出现以下错误。早些时候,我使用.collect()的输出scan_parquet()将结果转换为 DataFrame,但不幸的是它不适用于大于 RAM 的数据集。这是我收到的错误 -

PanicException: sink_parquet not yet supported in standard engine. Use 'collect().write_parquet()'
Run Code Online (Sandbox Code Playgroud)

在 LazyFrame 上添加一些过滤器和连接条件后,我尝试将 LazyFrame(scan_parquet 的输出)写入本地文件。错误似乎来自以下位置 -

https://github.com/pola-rs/polars/blob/master/py-polars/polars/internals/lazyframe/frame.py#L1235(Python

https://github.com/pola-rs/polars/blob/master/polars/polars-lazy/src/physical_plan/planner/lp.rs#L154(Rust)。

我已尝试更新到最新版本0.15.16 0.16.1 但此问题仍然存在。

示例代码:

pl.scan_parquet("path/to/file1.parquet")
.select([
    pl.col("col2"),
    pl.col("col2").apply( lambda x : ...)
    .alias("splited_levels"),
    ..followed by more columns and .alias()
])
.join(<another lazyframe>,on="some key",how="inner")
.filter(...)
.filter(..)
..followed by some more filters
.sink_parquet("path/to/result2.parquet")
Run Code Online (Sandbox Code Playgroud)

parquet 文件应写入本地系统中。相反,我收到以下错误 -

PanicException: sink_parquet not yet supported in standard engine. Use 'collect().write_parquet()'
Run Code Online (Sandbox Code Playgroud)

以下是我使用后安装的软件包的详细信息polars.show_versions()-

--- Version info----
Polars : 0.15.16
Index type : UInt32
Platform : Linux-4.15.0-191-generic-x86_64-with-glibc2.28
Python: 3.9.16
[GCC 8.3.0]
--- Optional dependencies---
pyarrow : 11.0.0
pandas : not installed
numpy : 1.24.1
fsspec : 2023.1.0
connectorx : not installed
xlsx2csv : not installed
deltalake: not installed
matplotlib : not installed
Run Code Online (Sandbox Code Playgroud)

更新:我在这里提出了一个 github 问题,目前看来所有类型的查询都不支持流式传输。因此,我正在寻找这种情况下的解决方法,或者使用极坐标进行此操作的任何替代方法 https://github.com/pola-rs/polars/issues/6603