[SPARK-45626][SQL] Convert _LEGACY_ERROR_TEMP_1055 to REQUIRES_SINGLE_PART_NAMESPACE

### What changes were proposed in this pull request?
The pr aims to convert `_LEGACY_ERROR_TEMP_1055` to `REQUIRES_SINGLE_PART_NAMESPACE`
PS: In addition, the variable name (`quoted` -> `database`) was incorrect in the original error class message template, and this issue was resolved in the above `convert`.

### Why are the changes needed?
Fix bug.

- Before:
   <img width="1327" alt="image" src="https://github.com/apache/spark/assets/15246973/e7a59837-4f14-4f09-872a-913d78006ede">

- After:
   <img width="1164" alt="image" src="https://github.com/apache/spark/assets/15246973/5d3928bf-e580-44b1-a86d-55654686e8d5">

### Does this PR introduce _any_ user-facing change?
No.

### How was this patch tested?
- Pass GA.
- Manually test:
```
./build/sbt "hive/testOnly org.apache.spark.sql.hive.execution.command.CreateNamespaceSuite -- -z \"REQUIRES_SINGLE_PART_NAMESPACE\""

[info] CreateNamespaceSuite:
[info] - CREATE NAMESPACE using Hive V1 catalog V1 command: REQUIRES_SINGLE_PART_NAMESPACE (392 milliseconds)
[info] - CREATE NAMESPACE using Hive V1 catalog V2 command: REQUIRES_SINGLE_PART_NAMESPACE (3 milliseconds)
15:24:14.648 WARN org.apache.hadoop.hive.metastore.ObjectStore: Version information not found in metastore. hive.metastore.schema.verification is not enabled so recording the schema version 2.3.0
15:24:14.648 WARN org.apache.hadoop.hive.metastore.ObjectStore: setMetaStoreSchemaVersion called but recording version is disabled: version = 2.3.0, comment = Set by MetaStore panbingkun172.24.144.16
15:24:14.654 WARN org.apache.hadoop.hive.metastore.ObjectStore: Failed to get database default, returning NoSuchObjectException
15:24:14.795 WARN org.apache.hadoop.hive.metastore.ObjectStore: Failed to get database global_temp, returning NoSuchObjectException
15:24:15.007 WARN org.apache.hadoop.hive.ql.session.SessionState: METASTORE_FILTER_HOOK will be ignored, since hive.security.authorization.manager is set to instance of HiveAuthorizerFactory.
[info] Run completed in 4 seconds, 819 milliseconds.
[info] Total number of tests run: 2
[info] Suites: completed 1, aborted 0
[info] Tests: succeeded 2, failed 0, canceled 0, ignored 0, pending 0
[info] All tests passed.
[success] Total time: 186 s (03:06), completed Oct 24, 2023, 3:24:15 PM
```

### Was this patch authored or co-authored using generative AI tooling?
No.

Closes #43479 from panbingkun/SPARK-45626.

Authored-by: panbingkun <pbk1982@gmail.com>
Signed-off-by: Max Gekk <max.gekk@gmail.com>
diff --git a/common/utils/src/main/resources/error/error-classes.json b/common/utils/src/main/resources/error/error-classes.json
index 5ef70b5..53c76b7 100644
--- a/common/utils/src/main/resources/error/error-classes.json
+++ b/common/utils/src/main/resources/error/error-classes.json
@@ -4184,11 +4184,6 @@
       "ALTER COLUMN cannot find column <colName> in v1 table. Available: <fieldNames>."
     ]
   },
-  "_LEGACY_ERROR_TEMP_1055" : {
-    "message" : [
-      "The database name is not valid: <quoted>."
-    ]
-  },
   "_LEGACY_ERROR_TEMP_1057" : {
     "message" : [
       "SHOW COLUMNS with conflicting databases: '<dbA>' != '<dbB>'."
diff --git a/docs/sql-error-conditions.md b/docs/sql-error-conditions.md
index ce39fce..20665e1 100644
--- a/docs/sql-error-conditions.md
+++ b/docs/sql-error-conditions.md
@@ -2310,5 +2310,3 @@
 The `<functionName>` requires `<expectedNum>` parameters but the actual number is `<actualNum>`.
 
 For more details see [WRONG_NUM_ARGS](sql-error-conditions-wrong-num-args-error-class.html)
-
-
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 92b1ace..499fd22 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
@@ -920,12 +920,6 @@
         "fieldNames" -> v1Table.schema.fieldNames.mkString(", ")))
   }
 
-  def invalidDatabaseNameError(quoted: String): Throwable = {
-    new AnalysisException(
-      errorClass = "_LEGACY_ERROR_TEMP_1055",
-      messageParameters = Map("database" -> quoted))
-  }
-
   def wrongCommandForObjectTypeError(
       operation: String,
       requiredType: String,
diff --git a/sql/core/src/main/scala/org/apache/spark/sql/catalyst/analysis/ResolveSessionCatalog.scala b/sql/core/src/main/scala/org/apache/spark/sql/catalyst/analysis/ResolveSessionCatalog.scala
index 56515ca..174881a 100644
--- a/sql/core/src/main/scala/org/apache/spark/sql/catalyst/analysis/ResolveSessionCatalog.scala
+++ b/sql/core/src/main/scala/org/apache/spark/sql/catalyst/analysis/ResolveSessionCatalog.scala
@@ -626,7 +626,7 @@
       case ResolvedNamespace(_, Seq(dbName)) => Some(dbName)
       case _ =>
         assert(resolved.namespace.length > 1)
-        throw QueryCompilationErrors.invalidDatabaseNameError(resolved.namespace.quoted)
+        throw QueryCompilationErrors.requiresSinglePartNamespaceError(resolved.namespace)
     }
   }
 }
diff --git a/sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/command/CreateNamespaceSuite.scala b/sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/command/CreateNamespaceSuite.scala
index afe6f11..12e41a5 100644
--- a/sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/command/CreateNamespaceSuite.scala
+++ b/sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/command/CreateNamespaceSuite.scala
@@ -17,6 +17,7 @@
 
 package org.apache.spark.sql.hive.execution.command
 
+import org.apache.spark.sql.AnalysisException
 import org.apache.spark.sql.execution.command.v1
 
 /**
@@ -25,4 +26,18 @@
  */
 class CreateNamespaceSuite extends v1.CreateNamespaceSuiteBase with CommandSuiteBase {
   override def commandVersion: String = super[CreateNamespaceSuiteBase].commandVersion
+
+  test("REQUIRES_SINGLE_PART_NAMESPACE") {
+    val namespace = "ns1.ns2"
+    checkError(
+      exception = intercept[AnalysisException] {
+        sql(s"CREATE NAMESPACE $catalog.$namespace")
+      },
+      errorClass = "REQUIRES_SINGLE_PART_NAMESPACE",
+      parameters = Map(
+        "sessionCatalog" -> catalog,
+        "namespace" -> "`ns1`.`ns2`"
+      )
+    )
+  }
 }