Spark Kryo 注册数组 class
Spark Kryo register for array class
我正在尝试用数组注册一个 class(激活 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
的情况下写一个注册 class 但是 Java 无法解析符号 InMemoryFileIndex$SerializableBlockLocation
:
kryo.register(org.apache.spark.sql.execution.datasources.InMemoryFileIndex$SerializableBlockLocation[].class);
所有其他 classes 在我的 KryoRegister.class 中工作。
我发现了一个类似的问题here,试试:
kryo.register(Array.newInstance(Class.forName("org.apache.spark.sql.execution.datasources.InMemoryFileIndex$SerializableBlockLocation"), 0)
.getClass());
发现你也可以试试:
spark.kryo.classesToRegister [Lorg.apache.spark.sql.execution.datasources.SerializableBlockLocation;
注册"org.apache.spark.sql.execution.datasources.SerializableBlockLocation[]"
我正在尝试用数组注册一个 class(激活 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
的情况下写一个注册 class 但是 Java 无法解析符号 InMemoryFileIndex$SerializableBlockLocation
:
kryo.register(org.apache.spark.sql.execution.datasources.InMemoryFileIndex$SerializableBlockLocation[].class);
所有其他 classes 在我的 KryoRegister.class 中工作。
我发现了一个类似的问题here,试试:
kryo.register(Array.newInstance(Class.forName("org.apache.spark.sql.execution.datasources.InMemoryFileIndex$SerializableBlockLocation"), 0)
.getClass());
发现你也可以试试:
spark.kryo.classesToRegister [Lorg.apache.spark.sql.execution.datasources.SerializableBlockLocation;
注册"org.apache.spark.sql.execution.datasources.SerializableBlockLocation[]"