gpt4 book ai didi

java - Spark Kryo 注册数组类

转载 作者:塔克拉玛干 更新时间:2023-11-03 05:23:49 25 4
gpt4 key购买 nike

我正在尝试用数组注册一个类(激活了 Kryo 的 Spark Java),日志显示一条​​明确的消息:

Class is not registered: org.apache.spark.sql.execution.datasources.InMemoryFileIndex$SerializableBlockLocation[]

我已经写了几个组合,但这些都不起作用:

        kryo.register(Class.forName("org.apache.spark.sql.execution.datasources.InMemoryFileIndex$SerializableBlockLocation[]")); // ERROR
kryo.register(Class.forName("org.apache.spark.sql.execution.datasources.InMemoryFileIndex$SerializableBlockLocation[].class")); // ERROR
kryo.register(Class.forName("org.apache.spark.sql.execution.datasources.InMemoryFileIndex$SerializableBlockLocation$Array")); // ERROR
kryo.register(Class.forName("[org.apache.spark.sql.execution.datasources.InMemoryFileIndex$SerializableBlockLocation")); // ERROR
kryo.register(Class.forName("[Lorg.apache.spark.sql.execution.datasources.InMemoryFileIndex$SerializableBlockLocation")); // ERROR
kryo.register(Class.forName("Array[org.apache.spark.sql.execution.datasources.InMemoryFileIndex$SerializableBlockLocation]")); // ERROR
kryo.register(Class.forName("[[org.apache.spark.sql.execution.datasources.InMemoryFileIndex$SerializableBlockLocation")); // ERROR

我也试过写一个没有 Class.forName 的注册类,但是 Java 无法解析符号 InMemoryFileIndex$SerializableBlockLocation:

kryo.register(org.apache.spark.sql.execution.datasources.InMemoryFileIndex$SerializableBlockLocation[].class);

所有其他类都在我的 KryoRegister.class 中工作。

最佳答案

我发现了一个类似的问题here , 尝试:

kryo.register(Array.newInstance(Class.forName("org.apache.spark.sql.execution.datasources.InMemoryFileIndex$SerializableBlockLocation"), 0)
.getClass());

关于java - Spark Kryo 注册数组类,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54106392/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com