fix: use FAILED_READ_FILE.FILE_NOT_EXIST in Spark 4.0 FileNotFound shim#4048
Closed
andygrove wants to merge 1 commit intoapache:mainfrom
Closed
fix: use FAILED_READ_FILE.FILE_NOT_EXIST in Spark 4.0 FileNotFound shim#4048andygrove wants to merge 1 commit intoapache:mainfrom
andygrove wants to merge 1 commit intoapache:mainfrom
Conversation
The Spark 4.0 `ShimSparkErrorConverter` was converting native FileNotFound
errors into a `SparkFileNotFoundException` with error class
`_LEGACY_ERROR_TEMP_2055`, but that error class was removed in Spark 4.0.
Throwing it triggers an internal error ("Cannot find main error class")
and fails tests such as `HiveMetadataCacheSuite` that assert on
`FAILED_READ_FILE.FILE_NOT_EXIST`.
Delegate to `QueryExecutionErrors.fileNotExistError`, which is the 4.0
replacement for `readCurrentFileNotFoundError` and produces the expected
error class and `path` parameter.
This was referenced Apr 23, 2026
Closed
Member
Author
|
this is included in #4047 - no need for separate PR |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Which issue does this PR close?
Related to #2946.
Rationale for this change
The Spark 4.0
ShimSparkErrorConvertertranslates native FileNotFound errors into aSparkFileNotFoundExceptionwith error class_LEGACY_ERROR_TEMP_2055. That error class exists in Spark 3.4 and 3.5 but was removed in Spark 4.0, so Spark'sErrorClassesJsonReaderthrows anINTERNAL_ERRORwhen it tries to look up the message template ("Cannot find main error class '_LEGACY_ERROR_TEMP_2055'").This manifests as test failures on
org.apache.spark.sql.hive.HiveMetadataCacheSuite(and any other suite that usescheckError/checkErrorMatchPValsagainstFAILED_READ_FILE.FILE_NOT_EXIST) when run against Spark 4.0 with Comet enabled:with underlying cause:
The previously ignored
sql_hive-1CI job for Spark 4.0 (issue #2946) surfaces these failures once the job is re-enabled.What changes are included in this PR?
In the Spark 4.0 shim, delegate to
QueryExecutionErrors.fileNotExistError(path, cause), which is the 4.0 replacement forreadCurrentFileNotFoundError. It produces aSparkExceptionwith the expected error classFAILED_READ_FILE.FILE_NOT_EXISTandpathparameter that tests assert on. The 3.4 and 3.5 shims are unchanged.How are these changes tested?
Covered by the existing Spark test
org.apache.spark.sql.hive.HiveMetadataCacheSuite(run in thesql_hive-1CI job for Spark 4.0), which previously failed on:SPARK-16337 temporary view refreshview refreshpartitioned table is cached when partition pruning is truepartitioned table is cached when partition pruning is falseRe-enabling that job will be handled separately.