如何访问Flink Map中在外面声明的Java变量?

发布于 2025-02-07 17:07:04 字数 99 浏览 2 评论 0原文

我正在Java创建列表。我想在Flink中的地图功能中分享列表。如何在跨链接过程中共享变量

要求 我有静态数据记录(少于1000个记录)。我想将这些记录与数据流一起加入。

I am creating a List in Java. I want to share the List within the map function in flink. How to share the variables across flink processes

Requirement
I have static data records(Less than 1000 records). I want to join these records with the data stream.

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

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

发布评论

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

评论(1

浅唱々樱花落 2025-02-14 17:07:04

Flink的设计考虑了可扩展性,因此它体现了A 共享方法。操作员可以是有状态的,但其状态严格是本地的,对其他运营商看不到。

在这种特殊情况下,一个好的解决方案可能是使用richmapfunction(或richflatmapfunction)进行加入,并将所有静态数据记录的副本加载到其Open方法中的本地瞬态数据结构。

Flink is designed with scalability in mind, and so it embodies a share nothing approach. An operator can be stateful, but its state is strictly local and not visible to other operators.

In this particular case, a good solution might be to use a RichMapFunction (or RichFlatMapFunction) to do the join, and to load a copy of all of the static data records into a local transient data structure in its open method.

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