【问题标题】:Arrow IPC vs FeatherArrow IPC 与 Feather
【发布时间】:2021-08-26 20:08:49
【问题描述】:
Arrow IPC 和 Feather 有什么区别?
official documentation 说:
版本 2 (V2),默认版本,精确表示为
磁盘上的 Arrow IPC 文件格式。 V2 文件支持存储所有 Arrow
数据类型以及使用 LZ4 或 ZSTD 进行压缩。 V2 是第一次制作
在 Apache Arrow 0.17.0 中可用。
而 vaex 是 pandas 的替代品,具有两种不同的功能,一种用于 Arrow IPC,另一种用于 Feather。 polars,另一个pandas替代品,表示Arrow IPC和Feather是一样的。
【问题讨论】:
标签:
pandas
apache-arrow
feather
vaex
【解决方案1】:
TL;DR Arrow IPC 文件格式和Feather V2没有区别。
由于 Feather 的两个版本以及 Arrow IPC 文件格式与 Arrow IPC 流格式之间存在一些混淆。
Feather 的两个版本,见FAQ entry:
“羽毛”文件格式怎么样?
Feather v1 格式是一种简化的自定义容器,用于在开发 Arrow IPC 文件格式之前将 Arrow 格式的子集写入磁盘。 “Feather 版本 2”现在完全是 Arrow IPC 文件格式,我们保留了“Feather”名称和 API 以实现向后兼容性。
所以 IPC == Feather(V2)。有些地方提到Feather mean Feather(V1),它不同于IPC文件格式。但是,这似乎不是问题所在:Polars 和 Vaex 似乎使用 Feather 来表示 Feather(V2)(尽管 Vaex 稍微误导性地说“Feather 完全表示为磁盘上的 Arrow IPC 文件格式,但也支持压缩")。
Vaex 公开了export_arrow 和export_feather。这与 Arrow 的另一点有关,因为它定义了 IPC 流格式和 IPC 文件格式。它们的不同之处在于文件格式有一个魔术字符串(用于文件识别)和一个页脚(用于支持随机访问读取)(documentation)。
export_feather 始终写入 IPC 文件格式 (==FeatherV2),而 export_arrow 允许您在 IPC 文件格式和 IPC 流格式之间进行选择。看看where export_feather was added,我认为混乱可能源于 PyArrow API,这使得如何使用 Feather API 方法(这是一种用户友好的便利)而不是 IPC 文件编写器(这就是 export_arrow用途)。但最终,所写的格式是相同的。