Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,12 @@

package org.apache.spark.sql.comet.shims

import java.io.FileNotFoundException

import scala.util.matching.Regex

import org.apache.spark.QueryContext
import org.apache.spark.SparkException
import org.apache.spark.SparkFileNotFoundException
import org.apache.spark.sql.errors.QueryExecutionErrors
import org.apache.spark.sql.types._
import org.apache.spark.unsafe.types.UTF8String
Expand Down Expand Up @@ -292,17 +293,13 @@ trait ShimSparkErrorConverter {

case "FileNotFound" =>
val msg = params("message").toString
// Extract file path from native error message and format like Hadoop's
// FileNotFoundException: "File <path> does not exist"
val path = ShimSparkErrorConverter.ObjectLocationPattern
.findFirstMatchIn(msg)
.map(_.group(1))
.getOrElse(msg)
// readCurrentFileNotFoundError was removed in Spark 4.0; construct directly
Some(
new SparkFileNotFoundException(
errorClass = "_LEGACY_ERROR_TEMP_2055",
messageParameters = Map("message" -> s"File $path does not exist")))
QueryExecutionErrors
.fileNotExistError(path, new FileNotFoundException(s"File $path does not exist")))

case _ =>
// Unknown error type - return None to trigger fallback
Expand Down
Loading