This is an automated email from the ASF dual-hosted git repository.

uros-b pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/spark.git


The following commit(s) were added to refs/heads/master by this push:
     new 9b452e002fb9 [SPARK-59794][SQL] Assign a name to the error condition 
_LEGACY_ERROR_TEMP_1079
9b452e002fb9 is described below

commit 9b452e002fb9985afd5971e67ee7a646c8c2b207
Author: Matthew B. <[email protected]>
AuthorDate: Fri Oct 9 18:35:50 2026 +0000

    [SPARK-59794][SQL] Assign a name to the error condition 
_LEGACY_ERROR_TEMP_1079
    
    ### What changes were proposed in this pull request?
    This PR assigns a proper name to the legacy error condition 
`_LEGACY_ERROR_TEMP_1079`, renaming it to 
`UNSUPPORTED_RESOURCE_TYPE_FOR_FUNCTION` (SQLSTATE `0A000`), as part of 
SPARK-37935 (migrate onto error classes). The condition is thrown by 
`QueryCompilationErrors.resourceTypeNotSupportedError`, raised when a function 
resource is loaded with a type other than `jar`, `file`, or `archive`. The 
message is reworded from `Resource Type '<resourceType>' is not supported.` to 
`Unsupported  [...]
    
    ### Why are the changes needed?
    `_LEGACY_ERROR_TEMP_*` conditions are placeholders without stable, 
meaningful names. Giving this condition a proper name improves the diagnostic 
experience and advances the SPARK-37935 goal of migrating all legacy error 
conditions onto named error classes.
    
    ### Does this PR introduce _any_ user-facing change?
    Yes. The error condition name changes from `_LEGACY_ERROR_TEMP_1079` to 
`UNSUPPORTED_RESOURCE_TYPE_FOR_FUNCTION`, and the message text changes from 
`Resource Type '<resourceType>' is not supported.` to `Unsupported resource 
type '<resourceType>' for a function.` This surfaces when loading a function 
resource of an unsupported type (for example via the Hive metastore function 
loader).
    
    ### How was this patch tested?
    Added a `checkError` test in `QueryCompilationErrorsSuite` asserting the 
new condition name and message parameters. Ran `SparkThrowableSuite` (validates 
`error-conditions.json` formatting, ordering, and SQLSTATE invariants) and 
`QueryCompilationErrorsSuite`; both pass.
    
    ### Was this patch authored or co-authored using generative AI tooling?
    Co-authored with Claude Opus 4.8
    
    Closes #59068 from Ma77Ball/assign-name-legacy-error-1079.
    
    Authored-by: Matthew B. <[email protected]>
    Signed-off-by: Uros Bojanic <[email protected]>
---
 common/utils/src/main/resources/error/error-conditions.json  | 11 ++++++-----
 .../org/apache/spark/sql/errors/QueryCompilationErrors.scala |  2 +-
 .../spark/sql/errors/QueryCompilationErrorsSuite.scala       | 12 +++++++++++-
 3 files changed, 18 insertions(+), 7 deletions(-)

diff --git a/common/utils/src/main/resources/error/error-conditions.json 
b/common/utils/src/main/resources/error/error-conditions.json
index 0acf778aa671..94d6b897b18c 100644
--- a/common/utils/src/main/resources/error/error-conditions.json
+++ b/common/utils/src/main/resources/error/error-conditions.json
@@ -9664,6 +9664,12 @@
     ],
     "sqlState" : "0A000"
   },
+  "UNSUPPORTED_RESOURCE_TYPE_FOR_FUNCTION" : {
+    "message" : [
+      "Unsupported resource type '<resourceType>' for a function."
+    ],
+    "sqlState" : "0A000"
+  },
   "UNSUPPORTED_SAVE_MODE" : {
     "message" : [
       "The save mode <saveMode> is not supported for:"
@@ -10417,11 +10423,6 @@
       "Only the tables/views belong to the same database can be retrieved. 
Querying tables/views are <qualifiedTableNames>."
     ]
   },
-  "_LEGACY_ERROR_TEMP_1079" : {
-    "message" : [
-      "Resource Type '<resourceType>' is not supported."
-    ]
-  },
   "_LEGACY_ERROR_TEMP_1080" : {
     "message" : [
       "Table <identifier> did not specify database."
diff --git 
a/sql/catalyst/src/main/scala/org/apache/spark/sql/errors/QueryCompilationErrors.scala
 
b/sql/catalyst/src/main/scala/org/apache/spark/sql/errors/QueryCompilationErrors.scala
index c16a7d20dfac..2cc4fa51132f 100644
--- 
a/sql/catalyst/src/main/scala/org/apache/spark/sql/errors/QueryCompilationErrors.scala
+++ 
b/sql/catalyst/src/main/scala/org/apache/spark/sql/errors/QueryCompilationErrors.scala
@@ -1453,7 +1453,7 @@ private[sql] object QueryCompilationErrors extends 
QueryErrorsBase with Compilat
 
   def resourceTypeNotSupportedError(resourceType: String): Throwable = {
     new AnalysisException(
-      errorClass = "_LEGACY_ERROR_TEMP_1079",
+      errorClass = "UNSUPPORTED_RESOURCE_TYPE_FOR_FUNCTION",
       messageParameters = Map("resourceType" -> resourceType))
   }
 
diff --git 
a/sql/core/src/test/scala/org/apache/spark/sql/errors/QueryCompilationErrorsSuite.scala
 
b/sql/core/src/test/scala/org/apache/spark/sql/errors/QueryCompilationErrorsSuite.scala
index f0573d7a97d7..482643b67876 100644
--- 
a/sql/core/src/test/scala/org/apache/spark/sql/errors/QueryCompilationErrorsSuite.scala
+++ 
b/sql/core/src/test/scala/org/apache/spark/sql/errors/QueryCompilationErrorsSuite.scala
@@ -23,7 +23,7 @@ import org.apache.spark.{SPARK_DOC_ROOT, 
SparkIllegalArgumentException, SparkUns
 import org.apache.spark.sql._
 import org.apache.spark.sql.api.java.{UDF1, UDF2, UDF23Test}
 import org.apache.spark.sql.catalyst.TableIdentifier
-import org.apache.spark.sql.catalyst.catalog.{CatalogStorageFormat, 
CatalogTable, CatalogTableType, InvalidUDFClassException}
+import org.apache.spark.sql.catalyst.catalog.{CatalogStorageFormat, 
CatalogTable, CatalogTableType, FunctionResourceType, InvalidUDFClassException}
 import org.apache.spark.sql.catalyst.expressions.{Coalesce, Literal, UnsafeRow}
 import org.apache.spark.sql.catalyst.parser.ParseException
 import org.apache.spark.sql.execution.datasources.SaveIntoDataSourceCommand
@@ -1159,6 +1159,16 @@ class QueryCompilationErrorsSuite
       parameters = Map("identifier" -> identifier.toString)
     )
   }
+
+  test("UNSUPPORTED_RESOURCE_TYPE_FOR_FUNCTION: unknown function resource 
type") {
+    checkError(
+      exception = intercept[AnalysisException] {
+        FunctionResourceType.fromString("unknown")
+      },
+      condition = "UNSUPPORTED_RESOURCE_TYPE_FOR_FUNCTION",
+      parameters = Map("resourceType" -> "unknown")
+    )
+  }
 }
 
 class MyCastToString extends SparkUserDefinedFunction(


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to