使用Flink与节俭

问题描述 投票:0回答:1

我在我的flink应用内看到一些关于我的旧货班的日志。

2020-06-01 14:31:28 INFO  TypeExtractor:1885 - Class class com.test.TestStruct contains custom serialization methods we do not call, so it cannot be used as a POJO type and must be processed as GenericType. Please read the Flink documentation on "Data Types & Serialization" for details of the effect on performance.

所以我按照这里的说明:

https:/flink.apache.orgnews20200415flink-serialization-tuning-vol-1.html#apache-thrift-via-kryo。

我这样做是为了节俭 TestStruct 以及其中所有的节约型结构。(虽然我跳过了命名类型)。

另外,生成的thrift代码是用Java写的,而flink应用是用scala写的。

我怎样才能让这个错误消失呢?因为我得到了另一个bug,如果我把我的dataStream转换为那个 TestStruct丢失了一些字段,我怀疑这是由于序列化的问题?我怀疑这是由于序列化问题造成的?

apache-flink thrift
1个回答
1
投票

其实从目前来看,这个警告是无法消除的,但也不是什么问题,原因如下。

这个警告基本上只是说Flink的类型系统没有使用任何内部序列化器,而是会把这个类型当作一个 "通用类型",也就是说,它是通过Kryo序列化的。如果你关注了我的博客文章,这正是你想要的:使用Kryo通过Thrift进行序列化。你可以使用调试器将断点设置为 TBaseSerializer 来验证是否使用了Thrift。

至于缺失的字段,我怀疑是在转换到您的 TestStruct 而在你的 (flat)map 操作符中,也许在用于将这个结构传递给下一个操作符的序列化中没有。你应该验证这些字段在哪里丢失了--如果你有这种情况,在你喜欢的IDE的调试器中的断点应该可以帮助你找到原因。

© www.soinside.com 2019 - 2024. All rights reserved.