Kryo setWarnUnregisteredClasses为true,在spark配置中什么也没显示

问题描述 投票:1回答:1
 val conf = new SparkConf()
    .setAppName("example")
    .setMaster("local[*]")
    .set("spark.serializer", "org.apache.spark.serializer.KryoSerializer")
    .set("setWarnUnregisteredClasses","true")

[registrationRequired设置为true时,它会引发class Person is not registered and also "org.apache.spark.internal.io.FileCommitProtocol$TaskCommitMessage" is not registered的异常

因此,现在默认情况下为false,因此将setWarnUnregisteredClasses设置为true,它应该针对文档https://github.com/EsotericSoftware/kryo#serializer-framework中提供的未注册类显示警告消息?但是,有关序列化的日志中未显示任何内容。

scala apache-spark serialization kryo
1个回答
0
投票

您正在使用kryo注册,因此需要向kryo注册custom类和其他类,并且这两个类都应实现序列化接口。

setWarnUnregisteredClasses将发出警告,而conf.set(“ spark.kryo.registrationRequired”,“ true”)会引发未注册类的异常。

您必须注册个人和TaskCommitMessage之类的>

conf.registerKryoClasses(Array(classOf[Person]))
© www.soinside.com 2019 - 2024. All rights reserved.