HUDI Spark Kryo. Task serialization failed: org.apache.spark.SparkException: Failed to register classes with Kryo

119 views Asked by At

I use spark-shell to run hudi, and the following are the configuration arguments:

spark-shell --packages org.apache.hudi:hudi-spark3.3-bundle_2.12:0.12.0 --conf 'spark.serializer=org.apache.spark.serializer.KryoSerializer' --conf 'spark.sql.catalog.spark_catalog=org.apache.spark.sql.hudi.catalog.HoodieCatalog' --conf 'spark.sql.extensions=org.apache.spark.sql.hudi.HoodieSparkSessionExtension' --conf 'spark.kryo.registrator=org.apache.spark.HoodieSparkKryoRegistrar'

In spark-shell, I import the following libraries and run a test case:

import org.apache.spark.sql.SaveMode._
import org.apache.hudi.DataSourceWriteOptions._
import org.apache.hudi.config.HoodieWriteConfig._
spark.range(1).write.format("org.apache.hudi").option(TABLE_NAME, "hudi_tab01").option(PRECOMBINE_FIELD_OPT_KEY, "id").option(RECORDKEY_FIELD_OPT_KEY, "id").mode(Overwrite).save("/tmp/hudi_tab01")

Then the following error occurred:

ERROR TorrentBroadcast: Store broadcast broadcast_0 fail, remove all pieces of the broadcast
org.apache.spark.SparkException: Job aborted due to stage failure: Task serialization failed: org.apache.spark.SparkException: Failed to register classes with Kryo
org.apache.spark.SparkException: Failed to register classes with Kryo
        at org.apache.spark.serializer.KryoSerializer.$anonfun$newKryo$5(KryoSerializer.scala:183)
        at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:23)
        at org.apache.spark.util.Utils$.withContextClassLoader(Utils.scala:233)
        at org.apache.spark.serializer.KryoSerializer.newKryo(KryoSerializer.scala:171)
        at org.apache.spark.serializer.KryoSerializer$$anon$1.create(KryoSerializer.scala:102)

Provided that I did not compile the hudi source code with Maven and only downloaded the hudi dependency package in the spark-shell. Is the error related to a jar dependency package? Is it related to the HUDI_CONF_DIR or hudi-defaults. conf file? If so, how should I configure it? Have any friends encountered this error and found a solution.

I would greatly appreciate it if it could be resolved! Thanks!

0

There are 0 answers