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 38222c4e8c58 [SPARK-45626][SQL] Convert _LEGACY_ERROR_TEMP_1055 to
REQUIRES_SINGLE_PART_NAMESPACE
38222c4e8c58 is described below
commit 38222c4e8c581502e65a4224c3c4201136f7e390
Author: panbingkun <[email protected]>
AuthorDate: Tue Oct 24 12:47:42 2023 +0500
[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 <[email protected]>
Signed-off-by: Max Gekk <[email protected]>
---
common/utils/src/main/resources/error/error-classes.json | 5 -----
docs/sql-error-conditions.md | 2 --
.../apache/spark/sql/errors/QueryCompilationErrors.scala | 6 ------
.../sql/catalyst/analysis/ResolveSessionCatalog.scala | 2 +-
.../sql/hive/execution/command/CreateNamespaceSuite.scala | 15 +++++++++++++++
5 files changed, 16 insertions(+), 14 deletions(-)
diff --git a/common/utils/src/main/resources/error/error-classes.json
b/common/utils/src/main/resources/error/error-classes.json
index 5ef70b583dfc..53c76b77c01e 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 ce39fce85e79..20665e1018d5 100644
--- a/docs/sql-error-conditions.md
+++ b/docs/sql-error-conditions.md
@@ -2310,5 +2310,3 @@ The operation `<operation>` requires a `<requiredType>`.
But `<objectName>` is a
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 92b1ace67d4d..499fd2222c4d 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 @@ private[sql] object QueryCompilationErrors extends
QueryErrorsBase with Compilat
"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 56515ca7e37a..174881a46592 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 @@ class ResolveSessionCatalog(val catalogManager:
CatalogManager)
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 afe6f1138d30..12e41a569b34 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 @@ import org.apache.spark.sql.execution.command.v1
*/
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`"
+ )
+ )
+ }
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]