【发布时间】:2018-04-07 19:34:27
【问题描述】:
我正在使用 AvroIO.writeCustomTypeToGenericRecords 根据事件消息的类型编写消息。 DestinationT 是自定义 bean 类,实现可序列化,运行代码时出现以下错误:
java.lang.RuntimeException: org.apache.beam.sdk.coders.Coder$NonDeterministicException: org.apache.beam.sdk.coders.SerializableCoder@5d436f5b is not deterministic because:
Java Serialization may be non-deterministic.
看来我必须为这个自定义 bean 类创建编码器。
【问题讨论】:
-
是的,您需要自定义编码器,或者您可以使用 AvroCoder。
-
谢谢...我正在使用案例类(来自 scala)如何编写相同的...我尝试使用 pipeline.getCoderRegistry.registerCoderForClass(classOf[SchemaVerticalSubject], AvroCoder. of(classOf[SchemaVert 我应该覆盖 getDestinationCoder
-
是的,如果只是注册编码器没有帮助,那应该会有所帮助。
标签: google-cloud-dataflow apache-beam