Skip to content

Commit 81cd6d8

Browse files
committed
fix: use SparkFileNotFoundException directly for Spark 4.0
readCurrentFileNotFoundError was removed in Spark 4.0. Construct SparkFileNotFoundException directly instead, which is accessible from the shim package.
1 parent 030105f commit 81cd6d8

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

spark/src/main/spark-4.0/org/apache/spark/sql/comet/shims/ShimSparkErrorConverter.scala

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import java.io.FileNotFoundException
2323

2424
import org.apache.spark.QueryContext
2525
import org.apache.spark.SparkException
26+
import org.apache.spark.SparkFileNotFoundException
2627
import org.apache.spark.sql.errors.QueryExecutionErrors
2728
import org.apache.spark.sql.types._
2829
import org.apache.spark.unsafe.types.UTF8String
@@ -261,9 +262,11 @@ trait ShimSparkErrorConverter {
261262
.findFirstMatchIn(msg)
262263
.map(_.group(1))
263264
.getOrElse(msg)
265+
// readCurrentFileNotFoundError was removed in Spark 4.0; construct directly
264266
Some(
265-
QueryExecutionErrors.readCurrentFileNotFoundError(
266-
new FileNotFoundException(s"File $path does not exist")))
267+
new SparkFileNotFoundException(
268+
errorClass = "_LEGACY_ERROR_TEMP_2055",
269+
messageParameters = Map("message" -> s"File $path does not exist")))
267270

268271
case _ =>
269272
// Unknown error type - return None to trigger fallback

0 commit comments

Comments
 (0)