如何从 PHP 代码创建 ORC 或 Parquet 文件?

How to create ORC or Parquet files from PHP code?

是否有任何库可用于从 PHP 应用以 ORC 或 Parquet 格式为 Presto 查询编写自定义数据文件?

如果不是,在这种情况下最佳做法是什么?希望不涉及设置 Map Reduce 集群。

10倍 -尼尔

https://github.com/apache/parquet-cpp project that provides a C++ implementation to write Parquet files without any use of MapReduce or the JVM. While there are already Python (https://arrow.apache.org/docs/python/parquet.html), Ruby / GLib (https://github.com/red-data-tools/parquet-glib) and NodeJS (https://github.com/skale-me/node-parquet) 绑定,还有 none PHP。但是鉴于那些提到的绑定,您应该能够很容易地为 PHP 编写绑定。

抱歉打扰了,但我觉得这个问题应该更新一下。

去年,我发布了第一个公开可用的 PHP 库 reading/writing Parquet 文件 php-parquet。 参见 https://github.com/jocoon/php-parquet and/or the published composer package https://packagist.org/packages/jocoon/parquet (composer require jocoon/parquet)。它是 parquet-dotnet 的部分端口并受其启发,基于 Apache Thrift 规范。

只要您没有特殊的压缩需求(例如 snappy),您就不需要奇特的 PHP 扩展。 BCMathGMP 是必需的,因为可能存在任意精度数字,并且您需要 zlib 可用(AFAIK Parquet 文件的 most-used/typical 压缩方法,更准确地说:gzip).

相应的 github 页面上提供了基本使用说明。

免责声明:我是这个包的开发者。这不是广告。该库是根据 MIT 许可证发布的。欢迎提交问题或贡献。

我们已经获得 Apache 许可 https://github.com/skipprd/php-parquet, a PHP binding for the C++ https://github.com/apache/parquet-cpp 实现,该实现已经过 skippr.io 的实战测试。

很高兴看到 jocoon/php-parquet 上的另一项努力。所以现在有一个 C 绑定和一个 PHP 实现可供选择! :)

免责声明:我是这个包的开发者。这不是广告。该库是在 Apache 许可下发布的。欢迎提交问题或贡献。