Apache Pig 可以从 STDIN 而不是文件加载数据吗?

发布于 2025-01-07 21:39:58 字数 114 浏览 1 评论 0原文

我想使用 Apache Pig 来转换/连接两个文件中的数据,但我想一步一步地实现它,这意味着,从真实数据中测试它,但尺寸较小(例如 10 行),是否可以使用从 STDIN 读取并输出到 STDOUT 的 Pig?

I want to use Apache pig to transform/join data in two files, but I want to implement it step by step, which means, test it from real data, but with a small size(10 lines for example), is it possible to use pig that read from STDIN and output to STDOUT?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

黒涩兲箜 2025-01-14 21:39:59

基本上Hadoop以各种方式支持Streaming,但Pig最初缺乏对加载的支持通过流式传输数据。不过,还是有一些解决方案的。

您可以查看 HStreaming

A = LOAD 'http://myurl.com:1234/index.html' USING HStream('\n') AS (f1, f2);

Basically Hadoop supports Streaming in various ways, but Pig originally lacked support for loading data through streaming. However there are some solutions.

You can check out HStreaming:

A = LOAD 'http://myurl.com:1234/index.html' USING HStream('\n') AS (f1, f2);
南…巷孤猫 2025-01-14 21:39:59

答案是否定的。在任何 MR 作业可以运行数据之前,数据需要传输到集群中的数据节点上。

但是,如果您使用少量数据样本并且只想做一些简单的事情,您可以在本地模式下使用 Pig,只需将 stdin 写入本地文件并通过脚本运行它。

但更大的问题是为什么要在数据流上使用 MR/Pig?它过去和现在都不是用于此类用途。

The answer is no. The data needs to be out in the cluster on data nodes before any MR job can even run over the data.

However if you are using a small sample of data and are just wanting to do something simple you could use Pig in local mode and just write stdin to a local file and run it through your script.

But the bigger question becomes why are you wanting to use MR/Pig on a stream of data? It was and is not intended for that type of use.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文