Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Spark 3.5: Fix broadcasting specs in RewriteTablePath #11982

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

manuzhang
Copy link
Collaborator

This PR fixes following exception when running rewrite_table_path action with Spark

java.lang.UnsupportedOperationException
	at org.apache.iceberg.spark.actions.RewriteTablePathSparkAction.writeDataManifest(RewriteTablePathSparkAction.java:535)
	at org.apache.iceberg.spark.actions.RewriteTablePathSparkAction.lambda$toManifests$fbc8fb31$1(RewriteTablePathSparkAction.java:491)
	at org.apache.spark.sql.execution.MapElementsExec.$anonfun$doExecute$9(objects.scala:302)
	at org.apache.spark.sql.execution.MapElementsExec.$anonfun$doExecute$11(objects.scala:309)
	at scala.collection.Iterator$$anon$10.next(Iterator.scala:461)
	at scala.collection.Iterator$$anon$10.next(Iterator.scala:461)
	at scala.collection.Iterator.foreach(Iterator.scala:943)
	at scala.collection.Iterator.foreach$(Iterator.scala:943)
	at scala.collection.AbstractIterator.foreach(Iterator.scala:1431)
	at scala.collection.TraversableOnce.reduceLeft(TraversableOnce.scala:237)
	at scala.collection.TraversableOnce.reduceLeft$(TraversableOnce.scala:220)
	at scala.collection.AbstractIterator.reduceLeft(Iterator.scala:1431)
	at org.apache.spark.rdd.RDD.$anonfun$reduce$2(RDD.scala:1183)
	at org.apache.spark.SparkContext.$anonfun$runJob$6(SparkContext.scala:2637)
	at org.apache.spark.scheduler.ResultTask.runTask(ResultTask.scala:93)
	at org.apache.spark.TaskContext.runTaskWithListeners(TaskContext.scala:161)
	at org.apache.spark.scheduler.Task.run(Task.scala:152)
	at org.apache.spark.executor.Executor$TaskRunner.$anonfun$run$4(Executor.scala:622)
	at org.apache.spark.util.SparkErrorUtils.tryWithSafeFinally(SparkErrorUtils.scala:64)
	at org.apache.spark.util.SparkErrorUtils.tryWithSafeFinally$(SparkErrorUtils.scala:61)
	at org.apache.spark.util.Utils$.tryWithSafeFinally(Utils.scala:94)
	at org.apache.spark.executor.Executor$TaskRunner.run(Executor.scala:625)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
	at java.base/java.lang.Thread.run(Thread.java:833)
Caused by: java.io.IOException: java.lang.UnsupportedOperationException
	at org.apache.spark.util.SparkErrorUtils.tryOrIOException(SparkErrorUtils.scala:42)
	at org.apache.spark.util.SparkErrorUtils.tryOrIOException$(SparkErrorUtils.scala:33)
	at org.apache.spark.util.Utils$.tryOrIOException(Utils.scala:94)
	at org.apache.spark.broadcast.TorrentBroadcast.readBroadcastBlock(TorrentBroadcast.scala:260)
	at org.apache.spark.broadcast.TorrentBroadcast.getValue(TorrentBroadcast.scala:117)
	at org.apache.iceberg.spark.actions.RewriteTablePathSparkAction.writeDataManifest(RewriteTablePathSparkAction.java:531)
	... 24 more

@@ -457,7 +458,7 @@ private RewriteContentFileResult rewriteManifests(

Broadcast<Table> serializableTable = sparkContext().broadcast(SerializableTable.copyOf(table));
Broadcast<Map<Integer, PartitionSpec>> specsById =
sparkContext().broadcast(tableMetadata.specsById());
sparkContext().broadcast(SerializableMap.copyOf(tableMetadata.specsById()));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you please add a test that reproduces the issue?

@manuzhang manuzhang added this to the Iceberg 1.8.0 milestone Jan 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants