[SPARK-58945][SQL] Fix mismatched messageParameters keys that cause INTERNAL_ERROR - #58225
Open
subhramit wants to merge 6 commits into
Open
[SPARK-58945][SQL] Fix mismatched messageParameters keys that cause INTERNAL_ERROR#58225subhramit wants to merge 6 commits into
messageParameters keys that cause INTERNAL_ERROR#58225subhramit wants to merge 6 commits into
Conversation
…ir error templates Signed-off-by: subhramit <subhramit.bb@live.in>
…2Dialect Signed-off-by: subhramit <subhramit.bb@live.in>
…ERROR_TEMP_3070` Signed-off-by: subhramit <subhramit.bb@live.in>
…est style Signed-off-by: subhramit <subhramit.bb@live.in>
…tercepted earlier Signed-off-by: subhramit <subhramit.bb@live.in>
Signed-off-by: Subhramit Basu <subhramit.bb@live.in>
uros-b
approved these changes
Aug 23, 2026
Member
|
Thank you @subhramit! |
Author
Thank you for the quick review :) I will be filing a small follow-up after this for SPARK-58946 (currently this doesn't surface because due to Update - filed as #58226. |
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.
Closes SPARK-58945
Note that the following description was initially generated using GPT 5.4, and then edited by me.
What changes were proposed in this pull request?
This fixes several broken Spark error-reporting paths caused by mismatches between
messageParameterskeys and the placeholders declared inerror-conditions.json.The changes fall into two groups:
Fix Scala-side parameter key mismatches
sql/catalyst/src/main/scala/org/apache/spark/sql/errors/QueryCompilationErrors.scala_LEGACY_ERROR_TEMP_2450: useclazzinstead ofinvalidClasssql/catalyst/src/main/scala/org/apache/spark/sql/errors/QueryExecutionErrors.scalaINVALID_PARAMETER_VALUE.EXTENSION: useinvalidValueinstead offileExtension/acceptableINVALID_WRITER_COMMIT_MESSAGE: usedetailinstead ofdetailssql/core/src/main/scala/org/apache/spark/sql/execution/streaming/state/StateStoreErrors.scalaSTATE_STORE_COLUMN_FAMILY_SCHEMA_INCOMPATIBLE: usecolFamilyName/oldSchema/newSchemasql/core/src/main/scala/org/apache/spark/sql/jdbc/H2Dialect.scalaTABLE_OR_VIEW_NOT_FOUND: add the missingsearchPathparameter as"not available".classifyExceptionreceives only pre-rendered strings fromJDBCTableCatalog.scala:104-106, so no Spark-side search path exists at that point.Fix one duplicated JSON message template
common/utils/src/main/resources/error/error-conditions.json_LEGACY_ERROR_TEMP_3069and_LEGACY_ERROR_TEMP_3070had byte-identical message templates._LEGACY_ERROR_TEMP_3069is the reserved-column-name collision case and its message is correct._LEGACY_ERROR_TEMP_3070is the unrecognized file metadata field fallback, and its Scala call site (Map("field" -> field.toString)) was already correct.This PR fixes only the template for
_LEGACY_ERROR_TEMP_3070, restoring the pre-error class-migration wording:Unrecognized file metadata field: <field>. This is the text the branch threw before the error-class migration in SPARK-46351, still visible at thev3.5.0tag.Also adds regression coverage for the fixed paths:
sql/core/src/test/scala/org/apache/spark/sql/errors/ErrorMessageParametersSuite.scalasql/core/src/test/scala/org/apache/spark/sql/errors/QueryExecutionErrorsSuite.scalasql/core/src/test/scala/org/apache/spark/sql/execution/datasources/v2/jdbc/JDBCTableCatalogSuite.scalasql/core/src/test/scala/org/apache/spark/sql/execution/datasources/FileSourceCustomMetadataStructSuite.scalaA minimal repro for one affected path is:
Before this change, that path fails during message rendering and surfaces
INTERNAL_ERRORinstead ofINVALID_PARAMETER_VALUE.EXTENSION.Why are the changes needed?
Spark's
StringSubstitutordefaults toenableUndefinedVariableException = true, so an unresolved placeholder throwsIllegalArgumentException, whichErrorClassesJSONReaderconverts intoSparkException.internalError.Error messages are rendered eagerly when constructing many exceptions. The relevant exception constructors call
SparkThrowableHelper.getMessageduring construction (example). When substitution fails, the intended exception instance is never created, so the affected paths returnINTERNAL_ERRORin place of the actual diagnosis.These are user-visible diagnostics bugs rather than behavior changes in the main execution path.
Two of the six sites are not demonstrated by an end-to-end repro today.
stateStoreColumnFamilyMismatchcurrently has no callers, so that path is latent. It would have failed during message construction before this fix, so the constructor is covered directly by a unit test.The
H2Dialect.scala:230change is also covered directly rather than throughloadTable(...): missing-tableloadTableis intercepted earlier byJDBCRDD.resolveTable(...), so that path does not exercise the dialect branch. The dialect classification path itself is fixed here by supplying the missingsearchPathparameter.For
_LEGACY_ERROR_TEMP_3070the failure mode differs: the Scala call site was already correct, but the JSON template was duplicated from_LEGACY_ERROR_TEMP_3069during the error-class migration in SPARK-46351, so the fallback reports a reserved-column-name collision that never occurred.Does this PR introduce any user-facing change?
Yes.
This PR fixes user-facing error reporting for the currently reachable affected paths on master, and also fixes two latent error paths.
Examples:
extensionvalues now reportINVALID_PARAMETER_VALUE.EXTENSIONinstead of failing during message construction.INVALID_WRITER_COMMIT_MESSAGEwith the intended detail text._LEGACY_ERROR_TEMP_3070now reportsUnrecognized file metadata field: <field>instead of the unrelated reserved-column-name message.The H2 dialect change is a correctness fix in the JDBC classification path, but it is not demonstrated here by an end-to-end query repro. The state store fix is latent today because
stateStoreColumnFamilyMismatchcurrently has no callers.This does not change the semantics of the underlying operations. It fixes the diagnostics that Spark surfaces when those error paths are hit.
How was this patch tested?
Added/updated regression tests:
ErrorMessageParametersSuiteQueryExecutionErrorsSuiteJDBCTableCatalogSuiteFileSourceCustomMetadataStructSuiteExecuted:
and all of them passed.
Also performed manual repro -
main:fa6f713:Was this patch authored or co-authored using generative AI tooling?
Generated-by: Claude Opus 5 + GPT-5.4 (Zed coding agent) + manually touched up in IntelliJ IDEA