This is an automated email from the ASF dual-hosted git repository. maxgekk 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 320097a2ed0 [SPARK-42254][SQL] Assign name to _LEGACY_ERROR_TEMP_1117 320097a2ed0 is described below commit 320097a2ed05099e805bffdf319ab05f81ee0cd5 Author: itholic <haejoon....@databricks.com> AuthorDate: Wed Feb 8 06:33:19 2023 +0500 [SPARK-42254][SQL] Assign name to _LEGACY_ERROR_TEMP_1117 ### What changes were proposed in this pull request? This PR proposes to assign name to _LEGACY_ERROR_TEMP_1117, "REQUIRES_SINGLE_PART_NAMESPACE". ### Why are the changes needed? We should assign proper name to _LEGACY_ERROR_TEMP_* ### Does this PR introduce _any_ user-facing change? No ### How was this patch tested? `./build/sbt "sql/testOnly org.apache.spark.sql.SQLQueryTestSuite*` Closes #39837 from itholic/LEGACY_1117. Authored-by: itholic <haejoon....@databricks.com> Signed-off-by: Max Gekk <max.g...@gmail.com> --- core/src/main/resources/error/error-classes.json | 11 ++++++----- .../org/apache/spark/sql/errors/QueryCompilationErrors.scala | 6 +++--- .../org/apache/spark/sql/connector/DataSourceV2SQLSuite.scala | 10 ++++++---- 3 files changed, 15 insertions(+), 12 deletions(-) diff --git a/core/src/main/resources/error/error-classes.json b/core/src/main/resources/error/error-classes.json index 8cc87a68d45..bef185c9616 100644 --- a/core/src/main/resources/error/error-classes.json +++ b/core/src/main/resources/error/error-classes.json @@ -1262,6 +1262,12 @@ ], "sqlState" : "42614" }, + "REQUIRES_SINGLE_PART_NAMESPACE" : { + "message" : [ + "<sessionCatalog> requires a single-part namespace, but got <namespace>." + ], + "sqlState" : "42K05" + }, "ROUTINE_ALREADY_EXISTS" : { "message" : [ "Cannot create the function <routineName> because it already exists.", @@ -2564,11 +2570,6 @@ "Sources support continuous: <continuousSources>." ] }, - "_LEGACY_ERROR_TEMP_1117" : { - "message" : [ - "<sessionCatalog> requires a single-part namespace, but got <ns>." - ] - }, "_LEGACY_ERROR_TEMP_1119" : { "message" : [ "<cmd> is not supported in JDBC catalog." 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 634e4ac094d..85444060d3b 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 @@ -1240,12 +1240,12 @@ private[sql] object QueryCompilationErrors extends QueryErrorsBase { new TableAlreadyExistsException(ident.asMultipartIdentifier) } - def requiresSinglePartNamespaceError(ns: Seq[String]): Throwable = { + def requiresSinglePartNamespaceError(namespace: Seq[String]): Throwable = { new AnalysisException( - errorClass = "_LEGACY_ERROR_TEMP_1117", + errorClass = "REQUIRES_SINGLE_PART_NAMESPACE", messageParameters = Map( "sessionCatalog" -> CatalogManager.SESSION_CATALOG_NAME, - "ns" -> ns.mkString("[", ", ", "]"))) + "namespace" -> toSQLId(namespace))) } def namespaceAlreadyExistsError(namespace: Array[String]): Throwable = { diff --git a/sql/core/src/test/scala/org/apache/spark/sql/connector/DataSourceV2SQLSuite.scala b/sql/core/src/test/scala/org/apache/spark/sql/connector/DataSourceV2SQLSuite.scala index 58ed4b2a55c..673d8029c24 100644 --- a/sql/core/src/test/scala/org/apache/spark/sql/connector/DataSourceV2SQLSuite.scala +++ b/sql/core/src/test/scala/org/apache/spark/sql/connector/DataSourceV2SQLSuite.scala @@ -2070,8 +2070,10 @@ class DataSourceV2SQLSuiteV1Filter // the session catalog, not the `global_temp` v2 catalog. sql(s"CREATE TABLE $globalTempDB.ns1.ns2.tbl (id bigint, data string) USING json") }, - errorClass = "_LEGACY_ERROR_TEMP_1117", - parameters = Map("sessionCatalog" -> "spark_catalog", "ns" -> "[global_temp, ns1, ns2]")) + errorClass = "REQUIRES_SINGLE_PART_NAMESPACE", + parameters = Map( + "sessionCatalog" -> "spark_catalog", + "namespace" -> "`global_temp`.`ns1`.`ns2`")) } test("table name same as catalog can be used") { @@ -2104,8 +2106,8 @@ class DataSourceV2SQLSuiteV1Filter def verify(sql: String): Unit = { checkError( exception = intercept[AnalysisException](spark.sql(sql)), - errorClass = "_LEGACY_ERROR_TEMP_1117", - parameters = Map("sessionCatalog" -> "spark_catalog", "ns" -> "[]")) + errorClass = "REQUIRES_SINGLE_PART_NAMESPACE", + parameters = Map("sessionCatalog" -> "spark_catalog", "namespace" -> "")) } verify(s"select * from $t") --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@spark.apache.org For additional commands, e-mail: commits-h...@spark.apache.org