You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2021/12/06 09:24:21 UTC

[GitHub] [spark] dchvn opened a new pull request #34819: [SPARK-33849][SQL][TESTS] Unify v1 and v2 DROP NAMESPACE tests

dchvn opened a new pull request #34819:
URL: https://github.com/apache/spark/pull/34819


   ### What changes were proposed in this pull request?
   1. Move the `DROP NAMESPACE` parsing tests from `DDLParserSuite` to `DropNamespaceParserSuite`
   2. Define the class `command.DropNamespaceSuiteBase` that is parent of `v1.DropNamespaceSuiteBase` and `v2.DropNamespaceSuite`.
   3. Define the class `v1.DropNamespaceSuiteBase` that is parent of `v1.DropNamespaceSuite` and `hive.execution.command.DropNamespaceSuite`.
   4. Place the v1 tests for `DROP NAMESPACE` from `DDLSuite` and v2 tests from `DataSourceV2SQLSuite` to the common trait `DropNamespaceSuiteBase`.
   5. Move TODO test from `DescribeNamespaceSuiteBase` to `v1.DropNamespaceSuiteBase` and `v2.DropNamespaceSuite`
   
   The changes follow the approach of [#30287](https://github.com/apache/spark/pull/30287)
   
   ### Why are the changes needed?
   1. The unification will allow to run common `DROP NAMESPACE` tests for both DSv1/Hive DSv1 and DSv2
   2. We can detect missing features and differences between DSv1 and DSv2 implementations.
   
   
   ### Does this PR introduce _any_ user-facing change?
   No
   
   
   ### How was this patch tested?
   v1/v2 and Hive v1 DropNamespaceSuite:
   
   ```$ build/sbt -Phive-2.3 -Phive-thriftserver "test:testOnly *DropNamespaceSuite"```
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] cloud-fan commented on a change in pull request #34819: [SPARK-37478][SQL][TESTS] Unify v1 and v2 DROP NAMESPACE tests

Posted by GitBox <gi...@apache.org>.
cloud-fan commented on a change in pull request #34819:
URL: https://github.com/apache/spark/pull/34819#discussion_r762966814



##########
File path: sql/core/src/test/scala/org/apache/spark/sql/execution/command/v1/DropNamespaceSuite.scala
##########
@@ -0,0 +1,71 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.spark.sql.execution.command.v1
+
+import org.apache.spark.sql.AnalysisException
+import org.apache.spark.sql.execution.command
+
+/**
+ * This base suite contains unified tests for the `DROP NAMESPACE` commands that check V1 table
+ * catalogs. The tests that cannot run for all V1 catalogs are located in more specific test
+ * suites:
+ *
+ *   - V1 In-Memory catalog: `org.apache.spark.sql.execution.command.v1.DropNamespaceSuite`
+ *   - V1 Hive External catalog: `org.apache.spark.sql.hive.execution.command.DropNamespaceSuite`
+ */
+trait DropNamespaceSuiteBase extends command.DropNamespaceSuiteBase {
+  override protected def builtinTopNamespaces: Seq[String] = Seq("default")
+
+  test("DropNamespace: drop default namespace") {
+    val message = intercept[AnalysisException] {
+      sql(s"DROP NAMESPACE default")
+    }.getMessage
+    assert(message.contains("Can not drop default database"))
+  }
+
+  test("DropNamespace: drop non-empty namespace with a non-cascading mode") {
+    sql(s"CREATE NAMESPACE $catalog.ns")
+    sql(s"CREATE TABLE $catalog.ns.table (id bigint) $defaultUsing")
+    checkNamespace(s"SHOW NAMESPACES IN $catalog", Seq("ns") ++ builtinTopNamespaces)
+
+    def assertDropFails(): Unit = {
+      val e = intercept[AnalysisException] {
+        sql(s"DROP NAMESPACE $catalog.ns")
+      }
+      assert(e.getMessage.contains("Database ns is not empty. One or more tables exist"))

Review comment:
       Can we unify it? We don't need to block this PR and can do this later.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] SparkQA commented on pull request #34819: [SPARK-37478][SQL][TESTS] Unify v1 and v2 DROP NAMESPACE tests

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #34819:
URL: https://github.com/apache/spark/pull/34819#issuecomment-986834742


   **[Test build #145948 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/145948/testReport)** for PR 34819 at commit [`c60e31b`](https://github.com/apache/spark/commit/c60e31b0b2e0de88b268b4a547ffca1d37c25076).
    * This patch passes all tests.
    * This patch merges cleanly.
    * This patch adds no public classes.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] AmplabJenkins removed a comment on pull request #34819: [SPARK-37478][SQL][TESTS] Unify v1 and v2 DROP NAMESPACE tests

Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #34819:
URL: https://github.com/apache/spark/pull/34819#issuecomment-987565283


   
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder-K8s/50446/
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] AmplabJenkins commented on pull request #34819: [SPARK-37478][SQL][TESTS] Unify v1 and v2 DROP NAMESPACE tests

Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #34819:
URL: https://github.com/apache/spark/pull/34819#issuecomment-986841810


   
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/145948/
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] AmplabJenkins removed a comment on pull request #34819: [SPARK-37478][SQL][TESTS] Unify v1 and v2 DROP NAMESPACE tests

Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #34819:
URL: https://github.com/apache/spark/pull/34819#issuecomment-986699054


   
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder-K8s/50423/
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] dchvn commented on pull request #34819: [SPARK-33849][SQL][TESTS] Unify v1 and v2 DROP NAMESPACE tests

Posted by GitBox <gi...@apache.org>.
dchvn commented on pull request #34819:
URL: https://github.com/apache/spark/pull/34819#issuecomment-986619182


   @MaxGekk, @cloud-fan, @imback82 Could you take a look? Many thanks!


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] dchvn commented on a change in pull request #34819: [SPARK-33849][SQL][TESTS] Unify v1 and v2 DROP NAMESPACE tests

Posted by GitBox <gi...@apache.org>.
dchvn commented on a change in pull request #34819:
URL: https://github.com/apache/spark/pull/34819#discussion_r762837855



##########
File path: sql/core/src/test/scala/org/apache/spark/sql/execution/command/v1/DropNamespaceSuite.scala
##########
@@ -0,0 +1,71 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.spark.sql.execution.command.v1
+
+import org.apache.spark.sql.AnalysisException
+import org.apache.spark.sql.execution.command
+
+/**
+ * This base suite contains unified tests for the `DROP NAMESPACE` commands that check V1 table
+ * catalogs. The tests that cannot run for all V1 catalogs are located in more specific test
+ * suites:
+ *
+ *   - V1 In-Memory catalog: `org.apache.spark.sql.execution.command.v1.DropNamespaceSuite`
+ *   - V1 Hive External catalog: `org.apache.spark.sql.hive.execution.command.DropNamespaceSuite`
+ */
+trait DropNamespaceSuiteBase extends command.DropNamespaceSuiteBase {
+  override protected def builtinTopNamespaces: Seq[String] = Seq("default")
+
+  test("DropNamespace: drop default namespace") {
+    val message = intercept[AnalysisException] {
+      sql(s"DROP NAMESPACE default")
+    }.getMessage
+    assert(message.contains("Can not drop default database"))
+  }
+
+  test("DropNamespace: drop non-empty namespace with a non-cascading mode") {
+    sql(s"CREATE NAMESPACE $catalog.ns")
+    sql(s"CREATE TABLE $catalog.ns.table (id bigint) $defaultUsing")
+    checkNamespace(s"SHOW NAMESPACES IN $catalog", Seq("ns") ++ builtinTopNamespaces)
+
+    def assertDropFails(): Unit = {
+      val e = intercept[AnalysisException] {
+        sql(s"DROP NAMESPACE $catalog.ns")
+      }
+      assert(e.getMessage.contains("Database ns is not empty. One or more tables exist"))
+    }
+
+    // $catalog.ns.table is present, thus $catalog.ns cannot be dropped.
+    assertDropFails()
+    sql(s"DROP TABLE $catalog.ns.table")
+
+    // Now that $catalog.ns is empty, it can be dropped.
+    sql(s"DROP NAMESPACE $catalog.ns")
+    checkNamespace(s"SHOW NAMESPACES IN $catalog", builtinTopNamespaces)
+  }
+
+  test("DropNamespace: Namespace does not exist") {
+    // Namespace $catalog.unknown does not exist.
+    val message = intercept[AnalysisException] {
+      sql(s"DROP DATABASE $catalog.unknown")
+    }.getMessage
+    assert(message.contains(s"Database 'unknown' not found"))

Review comment:
       This test in V1 throws `NoSuchDatabaseException` that is different from `NoSuchNamespaceException` in V2. So it is separated into V1 and V2 Suite instead of placed in SuiteBase.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] cloud-fan commented on a change in pull request #34819: [SPARK-37478][SQL][TESTS] Unify v1 and v2 DROP NAMESPACE tests

Posted by GitBox <gi...@apache.org>.
cloud-fan commented on a change in pull request #34819:
URL: https://github.com/apache/spark/pull/34819#discussion_r763628918



##########
File path: sql/core/src/test/scala/org/apache/spark/sql/execution/command/DropNamespaceSuiteBase.scala
##########
@@ -0,0 +1,114 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.spark.sql.execution.command
+
+import org.apache.spark.sql.{AnalysisException, QueryTest, Row}
+import org.apache.spark.sql.internal.SQLConf
+import org.apache.spark.sql.types.{StringType, StructType}
+
+/**
+ * This base suite contains unified tests for the `DROP NAMESPACE` command that check V1 and V2
+ * table catalogs. The tests that cannot run for all supported catalogs are located in more
+ * specific test suites:
+ *
+ *   - V2 table catalog tests: `org.apache.spark.sql.execution.command.v2.DropNamespaceSuite`
+ *   - V1 table catalog tests: `org.apache.spark.sql.execution.command.v1.DropNamespaceSuiteBase`
+ *     - V1 In-Memory catalog: `org.apache.spark.sql.execution.command.v1.DropNamespaceSuite`
+ *     - V1 Hive External catalog: `org.apache.spark.sql.hive.execution.command.DropNamespaceSuite`
+ */
+trait DropNamespaceSuiteBase extends QueryTest with DDLCommandTestUtils {
+  override val command = "DROP NAMESPACE"
+
+  protected def builtinTopNamespaces: Seq[String] = Seq.empty
+  protected def isCasePreserving: Boolean = true
+  protected def assertDropFails
+
+  protected def checkNamespace(expected: Seq[String]) = {
+    val df = spark.sql(s"SHOW NAMESPACES IN $catalog")
+    assert(df.schema === new StructType().add("namespace", StringType, false))
+    checkAnswer(df, expected.map(Row(_)))
+  }
+
+  test("basic tests") {
+    sql(s"CREATE NAMESPACE $catalog.ns")
+    checkNamespace(Seq("ns") ++ builtinTopNamespaces)
+
+    sql(s"DROP NAMESPACE $catalog.ns")
+    checkNamespace(builtinTopNamespaces)
+  }
+
+  test("DropNamespace: test handling of 'IF EXISTS'") {
+    // It must not throw any exceptions
+    sql(s"DROP NAMESPACE IF EXISTS $catalog.unknown")
+    checkNamespace(builtinTopNamespaces)
+  }
+
+  test("DropNamespace: Namespace does not exist") {
+    // Namespace $catalog.unknown does not exist.
+    val message = intercept[AnalysisException] {
+      sql(s"DROP DATABASE $catalog.unknown")
+    }.getMessage
+    assert(message.contains(s"'unknown' not found"))
+  }
+
+  test("DropNamespace: drop non-empty namespace with a non-cascading mode") {
+    sql(s"CREATE NAMESPACE $catalog.ns")
+    sql(s"CREATE TABLE $catalog.ns.table (id bigint) $defaultUsing")
+    checkNamespace(Seq("ns") ++ builtinTopNamespaces)
+
+    // $catalog.ns.table is present, thus $catalog.ns cannot be dropped.
+    assertDropFails
+    sql(s"DROP TABLE $catalog.ns.table")
+
+    // Now that $catalog.ns is empty, it can be dropped.
+    sql(s"DROP NAMESPACE $catalog.ns")
+    checkNamespace(builtinTopNamespaces)
+  }
+
+  test("DropNamespace: drop non-empty namespace with a cascade mode") {
+    sql(s"CREATE NAMESPACE $catalog.ns")
+    sql(s"CREATE TABLE $catalog.ns.table (id bigint) $defaultUsing")
+    checkNamespace(Seq("ns") ++ builtinTopNamespaces)
+
+    sql(s"DROP NAMESPACE $catalog.ns CASCADE")
+    checkNamespace(builtinTopNamespaces)
+  }
+
+  test("DropNamespace: drop current namespace") {
+    sql(s"CREATE NAMESPACE $catalog.ns")
+    sql(s"USE $catalog.ns")
+    sql(s"DROP NAMESPACE $catalog.ns")
+    checkNamespace(builtinTopNamespaces)
+  }
+
+  test("DropNamespace: drop namespace with case sensitivity") {

Review comment:
       nit: this is the drop namespace test suite, do we really need to put the `DropNamespace: ` prefix in all the test names here?




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] AmplabJenkins commented on pull request #34819: [SPARK-37478][SQL][TESTS] Unify v1 and v2 DROP NAMESPACE tests

Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #34819:
URL: https://github.com/apache/spark/pull/34819#issuecomment-987748929


   
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder-K8s/50455/
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] SparkQA commented on pull request #34819: [SPARK-37478][SQL][TESTS] Unify v1 and v2 DROP NAMESPACE tests

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #34819:
URL: https://github.com/apache/spark/pull/34819#issuecomment-987890237


   **[Test build #145980 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/145980/testReport)** for PR 34819 at commit [`980e2be`](https://github.com/apache/spark/commit/980e2bef44448d94d990ff91ac8c8fa3db75024d).
    * This patch passes all tests.
    * This patch merges cleanly.
    * This patch adds no public classes.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] cloud-fan closed pull request #34819: [SPARK-37478][SQL][TESTS] Unify v1 and v2 DROP NAMESPACE tests

Posted by GitBox <gi...@apache.org>.
cloud-fan closed pull request #34819:
URL: https://github.com/apache/spark/pull/34819


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] cloud-fan commented on a change in pull request #34819: [SPARK-37478][SQL][TESTS] Unify v1 and v2 DROP NAMESPACE tests

Posted by GitBox <gi...@apache.org>.
cloud-fan commented on a change in pull request #34819:
URL: https://github.com/apache/spark/pull/34819#discussion_r772816330



##########
File path: sql/core/src/test/scala/org/apache/spark/sql/execution/command/v2/DropNamespaceSuite.scala
##########
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.spark.sql.execution.command.v2
+
+import org.apache.spark.SparkException
+import org.apache.spark.sql.execution.command
+
+/**
+ * The class contains tests for the `DROP NAMESPACE` command to check V2 table catalogs.
+ */
+class DropNamespaceSuite extends command.DropNamespaceSuiteBase with CommandSuiteBase {
+  override protected def assertDropFails(): Unit = {
+    val e = intercept[SparkException] {

Review comment:
       can we change the v1 error message to match v2?




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] SparkQA commented on pull request #34819: [SPARK-37478][SQL][TESTS] Unify v1 and v2 DROP NAMESPACE tests

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #34819:
URL: https://github.com/apache/spark/pull/34819#issuecomment-987659072


   **[Test build #145980 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/145980/testReport)** for PR 34819 at commit [`980e2be`](https://github.com/apache/spark/commit/980e2bef44448d94d990ff91ac8c8fa3db75024d).


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] SparkQA commented on pull request #34819: [SPARK-37478][SQL][TESTS] Unify v1 and v2 DROP NAMESPACE tests

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #34819:
URL: https://github.com/apache/spark/pull/34819#issuecomment-987524749


   **[Test build #145971 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/145971/testReport)** for PR 34819 at commit [`3970d4d`](https://github.com/apache/spark/commit/3970d4d548c128dba33b9d8e8ce0b563da56fc17).


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] cloud-fan commented on a change in pull request #34819: [SPARK-37478][SQL][TESTS] Unify v1 and v2 DROP NAMESPACE tests

Posted by GitBox <gi...@apache.org>.
cloud-fan commented on a change in pull request #34819:
URL: https://github.com/apache/spark/pull/34819#discussion_r763627954



##########
File path: sql/core/src/test/scala/org/apache/spark/sql/execution/command/DropNamespaceSuiteBase.scala
##########
@@ -0,0 +1,114 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.spark.sql.execution.command
+
+import org.apache.spark.sql.{AnalysisException, QueryTest, Row}
+import org.apache.spark.sql.internal.SQLConf
+import org.apache.spark.sql.types.{StringType, StructType}
+
+/**
+ * This base suite contains unified tests for the `DROP NAMESPACE` command that check V1 and V2
+ * table catalogs. The tests that cannot run for all supported catalogs are located in more
+ * specific test suites:
+ *
+ *   - V2 table catalog tests: `org.apache.spark.sql.execution.command.v2.DropNamespaceSuite`
+ *   - V1 table catalog tests: `org.apache.spark.sql.execution.command.v1.DropNamespaceSuiteBase`
+ *     - V1 In-Memory catalog: `org.apache.spark.sql.execution.command.v1.DropNamespaceSuite`
+ *     - V1 Hive External catalog: `org.apache.spark.sql.hive.execution.command.DropNamespaceSuite`
+ */
+trait DropNamespaceSuiteBase extends QueryTest with DDLCommandTestUtils {
+  override val command = "DROP NAMESPACE"
+
+  protected def builtinTopNamespaces: Seq[String] = Seq.empty
+  protected def isCasePreserving: Boolean = true
+  protected def assertDropFails

Review comment:
       ```suggestion
     protected def assertDropFails(): Unit
   ```




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] dchvn commented on a change in pull request #34819: [SPARK-37478][SQL][TESTS] Unify v1 and v2 DROP NAMESPACE tests

Posted by GitBox <gi...@apache.org>.
dchvn commented on a change in pull request #34819:
URL: https://github.com/apache/spark/pull/34819#discussion_r763688759



##########
File path: sql/core/src/test/scala/org/apache/spark/sql/execution/command/v2/DropNamespaceSuite.scala
##########
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.spark.sql.execution.command.v2
+
+import org.apache.spark.SparkException
+import org.apache.spark.sql.execution.command
+
+/**
+ * The class contains tests for the `DROP NAMESPACE` command to check V2 table catalogs.
+ */
+class DropNamespaceSuite extends command.DropNamespaceSuiteBase with CommandSuiteBase {
+  override protected def assertDropFails(): Unit = {
+    val e = intercept[SparkException] {

Review comment:
       I will create a follow-up PR for this, it's ok? @cloud-fan 




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] AmplabJenkins commented on pull request #34819: [SPARK-37478][SQL][TESTS] Unify v1 and v2 DROP NAMESPACE tests

Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #34819:
URL: https://github.com/apache/spark/pull/34819#issuecomment-987895053


   
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/145980/
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] cloud-fan commented on a change in pull request #34819: [SPARK-37478][SQL][TESTS] Unify v1 and v2 DROP NAMESPACE tests

Posted by GitBox <gi...@apache.org>.
cloud-fan commented on a change in pull request #34819:
URL: https://github.com/apache/spark/pull/34819#discussion_r763628270



##########
File path: sql/core/src/test/scala/org/apache/spark/sql/execution/command/DropNamespaceSuiteBase.scala
##########
@@ -0,0 +1,114 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.spark.sql.execution.command
+
+import org.apache.spark.sql.{AnalysisException, QueryTest, Row}
+import org.apache.spark.sql.internal.SQLConf
+import org.apache.spark.sql.types.{StringType, StructType}
+
+/**
+ * This base suite contains unified tests for the `DROP NAMESPACE` command that check V1 and V2
+ * table catalogs. The tests that cannot run for all supported catalogs are located in more
+ * specific test suites:
+ *
+ *   - V2 table catalog tests: `org.apache.spark.sql.execution.command.v2.DropNamespaceSuite`
+ *   - V1 table catalog tests: `org.apache.spark.sql.execution.command.v1.DropNamespaceSuiteBase`
+ *     - V1 In-Memory catalog: `org.apache.spark.sql.execution.command.v1.DropNamespaceSuite`
+ *     - V1 Hive External catalog: `org.apache.spark.sql.hive.execution.command.DropNamespaceSuite`
+ */
+trait DropNamespaceSuiteBase extends QueryTest with DDLCommandTestUtils {
+  override val command = "DROP NAMESPACE"
+
+  protected def builtinTopNamespaces: Seq[String] = Seq.empty
+  protected def isCasePreserving: Boolean = true
+  protected def assertDropFails
+
+  protected def checkNamespace(expected: Seq[String]) = {
+    val df = spark.sql(s"SHOW NAMESPACES IN $catalog")
+    assert(df.schema === new StructType().add("namespace", StringType, false))
+    checkAnswer(df, expected.map(Row(_)))
+  }
+
+  test("basic tests") {
+    sql(s"CREATE NAMESPACE $catalog.ns")
+    checkNamespace(Seq("ns") ++ builtinTopNamespaces)
+
+    sql(s"DROP NAMESPACE $catalog.ns")
+    checkNamespace(builtinTopNamespaces)
+  }
+
+  test("DropNamespace: test handling of 'IF EXISTS'") {
+    // It must not throw any exceptions
+    sql(s"DROP NAMESPACE IF EXISTS $catalog.unknown")
+    checkNamespace(builtinTopNamespaces)
+  }
+
+  test("DropNamespace: Namespace does not exist") {
+    // Namespace $catalog.unknown does not exist.
+    val message = intercept[AnalysisException] {
+      sql(s"DROP DATABASE $catalog.unknown")

Review comment:
       Can we consistently use `DROP NAMESPACE` in the tests?




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] SparkQA commented on pull request #34819: [SPARK-37478][SQL][TESTS] Unify v1 and v2 DROP NAMESPACE tests

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #34819:
URL: https://github.com/apache/spark/pull/34819#issuecomment-987674099


   **[Test build #145971 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/145971/testReport)** for PR 34819 at commit [`3970d4d`](https://github.com/apache/spark/commit/3970d4d548c128dba33b9d8e8ce0b563da56fc17).
    * This patch passes all tests.
    * This patch merges cleanly.
    * This patch adds no public classes.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] SparkQA commented on pull request #34819: [SPARK-33849][SQL][TESTS] Unify v1 and v2 DROP NAMESPACE tests

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #34819:
URL: https://github.com/apache/spark/pull/34819#issuecomment-986607271


   **[Test build #145948 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/145948/testReport)** for PR 34819 at commit [`c60e31b`](https://github.com/apache/spark/commit/c60e31b0b2e0de88b268b4a547ffca1d37c25076).


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] dchvn commented on a change in pull request #34819: [SPARK-37478][SQL][TESTS] Unify v1 and v2 DROP NAMESPACE tests

Posted by GitBox <gi...@apache.org>.
dchvn commented on a change in pull request #34819:
URL: https://github.com/apache/spark/pull/34819#discussion_r772780721



##########
File path: sql/core/src/test/scala/org/apache/spark/sql/execution/command/v2/DropNamespaceSuite.scala
##########
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.spark.sql.execution.command.v2
+
+import org.apache.spark.SparkException
+import org.apache.spark.sql.execution.command
+
+/**
+ * The class contains tests for the `DROP NAMESPACE` command to check V2 table catalogs.
+ */
+class DropNamespaceSuite extends command.DropNamespaceSuiteBase with CommandSuiteBase {
+  override protected def assertDropFails(): Unit = {
+    val e = intercept[SparkException] {

Review comment:
       > Can we leave a TODO to unify the error? I think both v1 and v2 commands should throw `AnalysisException`, and the error message should only have one difference between v1 and v2: `Cannot drop a non-empty namespace: ...` vs `Cannot drop a non-empty database: ...`
   
   The error message of Hive External Catalog test is `Database ns is not empty. One or more tables exist.`, which is identical to the error message of v1. So we should keep this and remove TODO, or we should unify the error of v1, v2 test and then seperate the hive's one. Thanks. @cloud-fan @huaxingao




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] dchvn commented on a change in pull request #34819: [SPARK-37478][SQL][TESTS] Unify v1 and v2 DROP NAMESPACE tests

Posted by GitBox <gi...@apache.org>.
dchvn commented on a change in pull request #34819:
URL: https://github.com/apache/spark/pull/34819#discussion_r772897342



##########
File path: sql/core/src/test/scala/org/apache/spark/sql/execution/command/v2/DropNamespaceSuite.scala
##########
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.spark.sql.execution.command.v2
+
+import org.apache.spark.SparkException
+import org.apache.spark.sql.execution.command
+
+/**
+ * The class contains tests for the `DROP NAMESPACE` command to check V2 table catalogs.
+ */
+class DropNamespaceSuite extends command.DropNamespaceSuiteBase with CommandSuiteBase {
+  override protected def assertDropFails(): Unit = {
+    val e = intercept[SparkException] {

Review comment:
       yeah, I think we can. I'll try. Thank you, @cloud-fan. :smiley:




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] SparkQA commented on pull request #34819: [SPARK-37478][SQL][TESTS] Unify v1 and v2 DROP NAMESPACE tests

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #34819:
URL: https://github.com/apache/spark/pull/34819#issuecomment-987542670


   Kubernetes integration test starting
   URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/50446/
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] AmplabJenkins commented on pull request #34819: [SPARK-37478][SQL][TESTS] Unify v1 and v2 DROP NAMESPACE tests

Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #34819:
URL: https://github.com/apache/spark/pull/34819#issuecomment-987565283


   
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder-K8s/50446/
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] dchvn commented on a change in pull request #34819: [SPARK-37478][SQL][TESTS] Unify v1 and v2 DROP NAMESPACE tests

Posted by GitBox <gi...@apache.org>.
dchvn commented on a change in pull request #34819:
URL: https://github.com/apache/spark/pull/34819#discussion_r763683507



##########
File path: sql/core/src/test/scala/org/apache/spark/sql/execution/command/DropNamespaceSuiteBase.scala
##########
@@ -0,0 +1,114 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.spark.sql.execution.command
+
+import org.apache.spark.sql.{AnalysisException, QueryTest, Row}
+import org.apache.spark.sql.internal.SQLConf
+import org.apache.spark.sql.types.{StringType, StructType}
+
+/**
+ * This base suite contains unified tests for the `DROP NAMESPACE` command that check V1 and V2
+ * table catalogs. The tests that cannot run for all supported catalogs are located in more
+ * specific test suites:
+ *
+ *   - V2 table catalog tests: `org.apache.spark.sql.execution.command.v2.DropNamespaceSuite`
+ *   - V1 table catalog tests: `org.apache.spark.sql.execution.command.v1.DropNamespaceSuiteBase`
+ *     - V1 In-Memory catalog: `org.apache.spark.sql.execution.command.v1.DropNamespaceSuite`
+ *     - V1 Hive External catalog: `org.apache.spark.sql.hive.execution.command.DropNamespaceSuite`
+ */
+trait DropNamespaceSuiteBase extends QueryTest with DDLCommandTestUtils {
+  override val command = "DROP NAMESPACE"
+
+  protected def builtinTopNamespaces: Seq[String] = Seq.empty
+  protected def isCasePreserving: Boolean = true
+  protected def assertDropFails
+
+  protected def checkNamespace(expected: Seq[String]) = {
+    val df = spark.sql(s"SHOW NAMESPACES IN $catalog")
+    assert(df.schema === new StructType().add("namespace", StringType, false))
+    checkAnswer(df, expected.map(Row(_)))
+  }
+
+  test("basic tests") {
+    sql(s"CREATE NAMESPACE $catalog.ns")
+    checkNamespace(Seq("ns") ++ builtinTopNamespaces)
+
+    sql(s"DROP NAMESPACE $catalog.ns")
+    checkNamespace(builtinTopNamespaces)
+  }
+
+  test("DropNamespace: test handling of 'IF EXISTS'") {
+    // It must not throw any exceptions
+    sql(s"DROP NAMESPACE IF EXISTS $catalog.unknown")
+    checkNamespace(builtinTopNamespaces)
+  }
+
+  test("DropNamespace: Namespace does not exist") {
+    // Namespace $catalog.unknown does not exist.
+    val message = intercept[AnalysisException] {
+      sql(s"DROP DATABASE $catalog.unknown")
+    }.getMessage
+    assert(message.contains(s"'unknown' not found"))
+  }
+
+  test("DropNamespace: drop non-empty namespace with a non-cascading mode") {
+    sql(s"CREATE NAMESPACE $catalog.ns")
+    sql(s"CREATE TABLE $catalog.ns.table (id bigint) $defaultUsing")
+    checkNamespace(Seq("ns") ++ builtinTopNamespaces)
+
+    // $catalog.ns.table is present, thus $catalog.ns cannot be dropped.
+    assertDropFails
+    sql(s"DROP TABLE $catalog.ns.table")
+
+    // Now that $catalog.ns is empty, it can be dropped.
+    sql(s"DROP NAMESPACE $catalog.ns")
+    checkNamespace(builtinTopNamespaces)
+  }
+
+  test("DropNamespace: drop non-empty namespace with a cascade mode") {
+    sql(s"CREATE NAMESPACE $catalog.ns")
+    sql(s"CREATE TABLE $catalog.ns.table (id bigint) $defaultUsing")
+    checkNamespace(Seq("ns") ++ builtinTopNamespaces)
+
+    sql(s"DROP NAMESPACE $catalog.ns CASCADE")
+    checkNamespace(builtinTopNamespaces)
+  }
+
+  test("DropNamespace: drop current namespace") {
+    sql(s"CREATE NAMESPACE $catalog.ns")
+    sql(s"USE $catalog.ns")
+    sql(s"DROP NAMESPACE $catalog.ns")
+    checkNamespace(builtinTopNamespaces)
+  }
+
+  test("DropNamespace: drop namespace with case sensitivity") {

Review comment:
       yeah, will remove it. Thanks!




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] AmplabJenkins removed a comment on pull request #34819: [SPARK-37478][SQL][TESTS] Unify v1 and v2 DROP NAMESPACE tests

Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #34819:
URL: https://github.com/apache/spark/pull/34819#issuecomment-987748929


   
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder-K8s/50455/
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] cloud-fan commented on a change in pull request #34819: [SPARK-37478][SQL][TESTS] Unify v1 and v2 DROP NAMESPACE tests

Posted by GitBox <gi...@apache.org>.
cloud-fan commented on a change in pull request #34819:
URL: https://github.com/apache/spark/pull/34819#discussion_r762961076



##########
File path: sql/core/src/test/scala/org/apache/spark/sql/execution/command/DropNamespaceSuiteBase.scala
##########
@@ -0,0 +1,91 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.spark.sql.execution.command
+
+import org.apache.spark.sql.{QueryTest, Row}
+import org.apache.spark.sql.internal.SQLConf
+import org.apache.spark.sql.types.{StringType, StructType}
+
+/**
+ * This base suite contains unified tests for the `DROP NAMESPACE` command that check V1 and V2
+ * table catalogs. The tests that cannot run for all supported catalogs are located in more
+ * specific test suites:
+ *
+ *   - V2 table catalog tests: `org.apache.spark.sql.execution.command.v2.DropNamespaceSuite`
+ *   - V1 table catalog tests: `org.apache.spark.sql.execution.command.v1.DropNamespaceSuiteBase`
+ *     - V1 In-Memory catalog: `org.apache.spark.sql.execution.command.v1.DropNamespaceSuite`
+ *     - V1 Hive External catalog: `org.apache.spark.sql.hive.execution.command.DropNamespaceSuite`
+ */
+trait DropNamespaceSuiteBase extends QueryTest with DDLCommandTestUtils {
+  override val command = "DROP NAMESPACE"
+
+  protected def builtinTopNamespaces: Seq[String] = Seq.empty
+  protected def isCasePreserving: Boolean = true
+
+  protected def checkNamespace(sqlText: String, expected: Seq[String]) = {

Review comment:
       since we don't need the `sqlText` parameter, as it's always `SHOW NAMESPACES IN $catalog`




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] SparkQA commented on pull request #34819: [SPARK-37478][SQL][TESTS] Unify v1 and v2 DROP NAMESPACE tests

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #34819:
URL: https://github.com/apache/spark/pull/34819#issuecomment-987737318


   Kubernetes integration test status failure
   URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/50455/
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] dchvn commented on a change in pull request #34819: [SPARK-33849][SQL][TESTS] Unify v1 and v2 DROP NAMESPACE tests

Posted by GitBox <gi...@apache.org>.
dchvn commented on a change in pull request #34819:
URL: https://github.com/apache/spark/pull/34819#discussion_r762855911



##########
File path: sql/core/src/test/scala/org/apache/spark/sql/execution/command/v1/DropNamespaceSuite.scala
##########
@@ -0,0 +1,71 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.spark.sql.execution.command.v1
+
+import org.apache.spark.sql.AnalysisException
+import org.apache.spark.sql.execution.command
+
+/**
+ * This base suite contains unified tests for the `DROP NAMESPACE` commands that check V1 table
+ * catalogs. The tests that cannot run for all V1 catalogs are located in more specific test
+ * suites:
+ *
+ *   - V1 In-Memory catalog: `org.apache.spark.sql.execution.command.v1.DropNamespaceSuite`
+ *   - V1 Hive External catalog: `org.apache.spark.sql.hive.execution.command.DropNamespaceSuite`
+ */
+trait DropNamespaceSuiteBase extends command.DropNamespaceSuiteBase {
+  override protected def builtinTopNamespaces: Seq[String] = Seq("default")
+
+  test("DropNamespace: drop default namespace") {

Review comment:
       default namespace does not exist in V2, test for V1 and Hive only.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] AmplabJenkins removed a comment on pull request #34819: [SPARK-37478][SQL][TESTS] Unify v1 and v2 DROP NAMESPACE tests

Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #34819:
URL: https://github.com/apache/spark/pull/34819#issuecomment-986841810


   
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/145948/
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] dchvn commented on pull request #34819: [SPARK-37478][SQL][TESTS] Unify v1 and v2 DROP NAMESPACE tests

Posted by GitBox <gi...@apache.org>.
dchvn commented on pull request #34819:
URL: https://github.com/apache/spark/pull/34819#issuecomment-987524419


   ping @cloud-fan, updated as your reviews. Could you take a look? Thanks!


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] cloud-fan commented on a change in pull request #34819: [SPARK-37478][SQL][TESTS] Unify v1 and v2 DROP NAMESPACE tests

Posted by GitBox <gi...@apache.org>.
cloud-fan commented on a change in pull request #34819:
URL: https://github.com/apache/spark/pull/34819#discussion_r763629654



##########
File path: sql/core/src/test/scala/org/apache/spark/sql/execution/command/v2/DropNamespaceSuite.scala
##########
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.spark.sql.execution.command.v2
+
+import org.apache.spark.SparkException
+import org.apache.spark.sql.execution.command
+
+/**
+ * The class contains tests for the `DROP NAMESPACE` command to check V2 table catalogs.
+ */
+class DropNamespaceSuite extends command.DropNamespaceSuiteBase with CommandSuiteBase {
+  override protected def assertDropFails(): Unit = {
+    val e = intercept[SparkException] {

Review comment:
       If you think the change is small, you can also include it in this PR




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] cloud-fan commented on a change in pull request #34819: [SPARK-37478][SQL][TESTS] Unify v1 and v2 DROP NAMESPACE tests

Posted by GitBox <gi...@apache.org>.
cloud-fan commented on a change in pull request #34819:
URL: https://github.com/apache/spark/pull/34819#discussion_r762967427



##########
File path: sql/core/src/test/scala/org/apache/spark/sql/execution/command/v1/DropNamespaceSuite.scala
##########
@@ -0,0 +1,71 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.spark.sql.execution.command.v1
+
+import org.apache.spark.sql.AnalysisException
+import org.apache.spark.sql.execution.command
+
+/**
+ * This base suite contains unified tests for the `DROP NAMESPACE` commands that check V1 table
+ * catalogs. The tests that cannot run for all V1 catalogs are located in more specific test
+ * suites:
+ *
+ *   - V1 In-Memory catalog: `org.apache.spark.sql.execution.command.v1.DropNamespaceSuite`
+ *   - V1 Hive External catalog: `org.apache.spark.sql.hive.execution.command.DropNamespaceSuite`
+ */
+trait DropNamespaceSuiteBase extends command.DropNamespaceSuiteBase {
+  override protected def builtinTopNamespaces: Seq[String] = Seq("default")
+
+  test("DropNamespace: drop default namespace") {
+    val message = intercept[AnalysisException] {
+      sql(s"DROP NAMESPACE default")
+    }.getMessage
+    assert(message.contains("Can not drop default database"))
+  }
+
+  test("DropNamespace: drop non-empty namespace with a non-cascading mode") {
+    sql(s"CREATE NAMESPACE $catalog.ns")
+    sql(s"CREATE TABLE $catalog.ns.table (id bigint) $defaultUsing")
+    checkNamespace(s"SHOW NAMESPACES IN $catalog", Seq("ns") ++ builtinTopNamespaces)
+
+    def assertDropFails(): Unit = {
+      val e = intercept[AnalysisException] {
+        sql(s"DROP NAMESPACE $catalog.ns")
+      }
+      assert(e.getMessage.contains("Database ns is not empty. One or more tables exist"))
+    }
+
+    // $catalog.ns.table is present, thus $catalog.ns cannot be dropped.
+    assertDropFails()
+    sql(s"DROP TABLE $catalog.ns.table")
+
+    // Now that $catalog.ns is empty, it can be dropped.
+    sql(s"DROP NAMESPACE $catalog.ns")
+    checkNamespace(s"SHOW NAMESPACES IN $catalog", builtinTopNamespaces)
+  }
+
+  test("DropNamespace: Namespace does not exist") {
+    // Namespace $catalog.unknown does not exist.
+    val message = intercept[AnalysisException] {
+      sql(s"DROP DATABASE $catalog.unknown")
+    }.getMessage
+    assert(message.contains(s"Database 'unknown' not found"))

Review comment:
       do these 2 exceptions both extends `AnalysisException`? We can check that instead.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] cloud-fan commented on a change in pull request #34819: [SPARK-37478][SQL][TESTS] Unify v1 and v2 DROP NAMESPACE tests

Posted by GitBox <gi...@apache.org>.
cloud-fan commented on a change in pull request #34819:
URL: https://github.com/apache/spark/pull/34819#discussion_r762968339



##########
File path: sql/core/src/test/scala/org/apache/spark/sql/execution/command/v2/DropNamespaceSuite.scala
##########
@@ -0,0 +1,56 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.spark.sql.execution.command.v2
+
+import org.apache.spark.SparkException
+import org.apache.spark.sql.AnalysisException
+import org.apache.spark.sql.execution.command
+
+/**
+ * The class contains tests for the `DROP NAMESPACE` command to check V2 table catalogs.
+ */
+class DropNamespaceSuite extends command.DropNamespaceSuiteBase with CommandSuiteBase {
+  test("DropNamespace: drop non-empty namespace with a non-cascading mode") {
+    sql(s"CREATE NAMESPACE $catalog.ns")
+    sql(s"CREATE TABLE $catalog.ns.table (id bigint) $defaultUsing")
+    checkNamespace(s"SHOW NAMESPACES IN $catalog", Seq("ns") ++ builtinTopNamespaces)
+
+    def assertDropFails(): Unit = {
+      val e = intercept[SparkException] {
+        sql(s"DROP NAMESPACE $catalog.ns")
+      }
+      assert(e.getMessage.contains("Cannot drop a non-empty namespace: ns"))

Review comment:
       We can follow `DescribeNamespaceSuiteBase` and add a method to abstract out the differences in the error message.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] SparkQA removed a comment on pull request #34819: [SPARK-37478][SQL][TESTS] Unify v1 and v2 DROP NAMESPACE tests

Posted by GitBox <gi...@apache.org>.
SparkQA removed a comment on pull request #34819:
URL: https://github.com/apache/spark/pull/34819#issuecomment-986607271


   **[Test build #145948 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/145948/testReport)** for PR 34819 at commit [`c60e31b`](https://github.com/apache/spark/commit/c60e31b0b2e0de88b268b4a547ffca1d37c25076).


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] SparkQA commented on pull request #34819: [SPARK-37478][SQL][TESTS] Unify v1 and v2 DROP NAMESPACE tests

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #34819:
URL: https://github.com/apache/spark/pull/34819#issuecomment-987559643


   Kubernetes integration test status failure
   URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/50446/
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] SparkQA removed a comment on pull request #34819: [SPARK-37478][SQL][TESTS] Unify v1 and v2 DROP NAMESPACE tests

Posted by GitBox <gi...@apache.org>.
SparkQA removed a comment on pull request #34819:
URL: https://github.com/apache/spark/pull/34819#issuecomment-987524749


   **[Test build #145971 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/145971/testReport)** for PR 34819 at commit [`3970d4d`](https://github.com/apache/spark/commit/3970d4d548c128dba33b9d8e8ce0b563da56fc17).


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] AmplabJenkins commented on pull request #34819: [SPARK-37478][SQL][TESTS] Unify v1 and v2 DROP NAMESPACE tests

Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #34819:
URL: https://github.com/apache/spark/pull/34819#issuecomment-987700306


   
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/145971/
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] dchvn commented on a change in pull request #34819: [SPARK-37478][SQL][TESTS] Unify v1 and v2 DROP NAMESPACE tests

Posted by GitBox <gi...@apache.org>.
dchvn commented on a change in pull request #34819:
URL: https://github.com/apache/spark/pull/34819#discussion_r772887958



##########
File path: sql/core/src/test/scala/org/apache/spark/sql/execution/command/v2/DropNamespaceSuite.scala
##########
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.spark.sql.execution.command.v2
+
+import org.apache.spark.SparkException
+import org.apache.spark.sql.execution.command
+
+/**
+ * The class contains tests for the `DROP NAMESPACE` command to check V2 table catalogs.
+ */
+class DropNamespaceSuite extends command.DropNamespaceSuiteBase with CommandSuiteBase {
+  override protected def assertDropFails(): Unit = {
+    val e = intercept[SparkException] {

Review comment:
       yes, we can. After that, the test in `Hive External Catalog` would fail since it extends `v1.DropNamespaceSuiteBase`. So I think we should unify the error of v1, v2 test, and then create another one in Hive external catalog test that contains error message `Database ns is not empty. One or more tables exist.`. WDYT, @cloud-fan ?




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] cloud-fan commented on a change in pull request #34819: [SPARK-37478][SQL][TESTS] Unify v1 and v2 DROP NAMESPACE tests

Posted by GitBox <gi...@apache.org>.
cloud-fan commented on a change in pull request #34819:
URL: https://github.com/apache/spark/pull/34819#discussion_r772893136



##########
File path: sql/core/src/test/scala/org/apache/spark/sql/execution/command/v2/DropNamespaceSuite.scala
##########
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.spark.sql.execution.command.v2
+
+import org.apache.spark.SparkException
+import org.apache.spark.sql.execution.command
+
+/**
+ * The class contains tests for the `DROP NAMESPACE` command to check V2 table catalogs.
+ */
+class DropNamespaceSuite extends command.DropNamespaceSuiteBase with CommandSuiteBase {
+  override protected def assertDropFails(): Unit = {
+    val e = intercept[SparkException] {

Review comment:
       can we unify the error message everywhere? We can try-catch the error from hive catalog and re-throw it with a different error message?




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] cloud-fan commented on a change in pull request #34819: [SPARK-37478][SQL][TESTS] Unify v1 and v2 DROP NAMESPACE tests

Posted by GitBox <gi...@apache.org>.
cloud-fan commented on a change in pull request #34819:
URL: https://github.com/apache/spark/pull/34819#discussion_r763628412



##########
File path: sql/core/src/test/scala/org/apache/spark/sql/execution/command/DropNamespaceSuiteBase.scala
##########
@@ -0,0 +1,114 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.spark.sql.execution.command
+
+import org.apache.spark.sql.{AnalysisException, QueryTest, Row}
+import org.apache.spark.sql.internal.SQLConf
+import org.apache.spark.sql.types.{StringType, StructType}
+
+/**
+ * This base suite contains unified tests for the `DROP NAMESPACE` command that check V1 and V2
+ * table catalogs. The tests that cannot run for all supported catalogs are located in more
+ * specific test suites:
+ *
+ *   - V2 table catalog tests: `org.apache.spark.sql.execution.command.v2.DropNamespaceSuite`
+ *   - V1 table catalog tests: `org.apache.spark.sql.execution.command.v1.DropNamespaceSuiteBase`
+ *     - V1 In-Memory catalog: `org.apache.spark.sql.execution.command.v1.DropNamespaceSuite`
+ *     - V1 Hive External catalog: `org.apache.spark.sql.hive.execution.command.DropNamespaceSuite`
+ */
+trait DropNamespaceSuiteBase extends QueryTest with DDLCommandTestUtils {
+  override val command = "DROP NAMESPACE"
+
+  protected def builtinTopNamespaces: Seq[String] = Seq.empty
+  protected def isCasePreserving: Boolean = true
+  protected def assertDropFails
+
+  protected def checkNamespace(expected: Seq[String]) = {
+    val df = spark.sql(s"SHOW NAMESPACES IN $catalog")
+    assert(df.schema === new StructType().add("namespace", StringType, false))
+    checkAnswer(df, expected.map(Row(_)))
+  }
+
+  test("basic tests") {
+    sql(s"CREATE NAMESPACE $catalog.ns")
+    checkNamespace(Seq("ns") ++ builtinTopNamespaces)
+
+    sql(s"DROP NAMESPACE $catalog.ns")
+    checkNamespace(builtinTopNamespaces)
+  }
+
+  test("DropNamespace: test handling of 'IF EXISTS'") {
+    // It must not throw any exceptions
+    sql(s"DROP NAMESPACE IF EXISTS $catalog.unknown")
+    checkNamespace(builtinTopNamespaces)
+  }
+
+  test("DropNamespace: Namespace does not exist") {
+    // Namespace $catalog.unknown does not exist.
+    val message = intercept[AnalysisException] {
+      sql(s"DROP DATABASE $catalog.unknown")
+    }.getMessage
+    assert(message.contains(s"'unknown' not found"))
+  }
+
+  test("DropNamespace: drop non-empty namespace with a non-cascading mode") {
+    sql(s"CREATE NAMESPACE $catalog.ns")
+    sql(s"CREATE TABLE $catalog.ns.table (id bigint) $defaultUsing")
+    checkNamespace(Seq("ns") ++ builtinTopNamespaces)
+
+    // $catalog.ns.table is present, thus $catalog.ns cannot be dropped.
+    assertDropFails

Review comment:
       ```suggestion
       assertDropFails()
   ```




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] dchvn commented on pull request #34819: [SPARK-37478][SQL][TESTS] Unify v1 and v2 DROP NAMESPACE tests

Posted by GitBox <gi...@apache.org>.
dchvn commented on pull request #34819:
URL: https://github.com/apache/spark/pull/34819#issuecomment-988387706


   Thank you!


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] SparkQA commented on pull request #34819: [SPARK-37478][SQL][TESTS] Unify v1 and v2 DROP NAMESPACE tests

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #34819:
URL: https://github.com/apache/spark/pull/34819#issuecomment-987687224


   Kubernetes integration test starting
   URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/50455/
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] dchvn commented on a change in pull request #34819: [SPARK-33849][SQL][TESTS] Unify v1 and v2 DROP NAMESPACE tests

Posted by GitBox <gi...@apache.org>.
dchvn commented on a change in pull request #34819:
URL: https://github.com/apache/spark/pull/34819#discussion_r762838321



##########
File path: sql/core/src/test/scala/org/apache/spark/sql/execution/command/v2/DropNamespaceSuite.scala
##########
@@ -0,0 +1,56 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.spark.sql.execution.command.v2
+
+import org.apache.spark.SparkException
+import org.apache.spark.sql.AnalysisException
+import org.apache.spark.sql.execution.command
+
+/**
+ * The class contains tests for the `DROP NAMESPACE` command to check V2 table catalogs.
+ */
+class DropNamespaceSuite extends command.DropNamespaceSuiteBase with CommandSuiteBase {
+  test("DropNamespace: drop non-empty namespace with a non-cascading mode") {
+    sql(s"CREATE NAMESPACE $catalog.ns")
+    sql(s"CREATE TABLE $catalog.ns.table (id bigint) $defaultUsing")
+    checkNamespace(s"SHOW NAMESPACES IN $catalog", Seq("ns") ++ builtinTopNamespaces)
+
+    def assertDropFails(): Unit = {
+      val e = intercept[SparkException] {
+        sql(s"DROP NAMESPACE $catalog.ns")
+      }
+      assert(e.getMessage.contains("Cannot drop a non-empty namespace: ns"))
+    }
+
+    // $catalog.ns.table is present, thus $catalog.ns cannot be dropped.
+    assertDropFails()
+    sql(s"DROP TABLE $catalog.ns.table")
+
+    // Now that $catalog.ns is empty, it can be dropped.
+    sql(s"DROP NAMESPACE $catalog.ns")
+    checkNamespace(s"SHOW NAMESPACES IN $catalog", builtinTopNamespaces)
+  }
+
+  test("DropNamespace: Namespace does not exist") {
+    // Namespace $catalog.unknown does not exist.
+    val message = intercept[AnalysisException] {
+      sql(s"DROP DATABASE $catalog.unknown")
+    }.getMessage
+    assert(message.contains(s"Namespace 'unknown' not found"))

Review comment:
       This test in V2 throws `NoSuchNamespaceException` that is different from `NoSuchDatabaseException` in V1. So it is separated into V1 and V2 Suite instead of placed in SuiteBase.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] dchvn commented on a change in pull request #34819: [SPARK-33849][SQL][TESTS] Unify v1 and v2 DROP NAMESPACE tests

Posted by GitBox <gi...@apache.org>.
dchvn commented on a change in pull request #34819:
URL: https://github.com/apache/spark/pull/34819#discussion_r762844139



##########
File path: sql/core/src/test/scala/org/apache/spark/sql/execution/command/v2/DropNamespaceSuite.scala
##########
@@ -0,0 +1,56 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.spark.sql.execution.command.v2
+
+import org.apache.spark.SparkException
+import org.apache.spark.sql.AnalysisException
+import org.apache.spark.sql.execution.command
+
+/**
+ * The class contains tests for the `DROP NAMESPACE` command to check V2 table catalogs.
+ */
+class DropNamespaceSuite extends command.DropNamespaceSuiteBase with CommandSuiteBase {
+  test("DropNamespace: drop non-empty namespace with a non-cascading mode") {
+    sql(s"CREATE NAMESPACE $catalog.ns")
+    sql(s"CREATE TABLE $catalog.ns.table (id bigint) $defaultUsing")
+    checkNamespace(s"SHOW NAMESPACES IN $catalog", Seq("ns") ++ builtinTopNamespaces)
+
+    def assertDropFails(): Unit = {
+      val e = intercept[SparkException] {
+        sql(s"DROP NAMESPACE $catalog.ns")
+      }
+      assert(e.getMessage.contains("Cannot drop a non-empty namespace: ns"))

Review comment:
       The exception and message of test `drop non-empty namespace with a non-cascading mode` that throw in `V1 DropNamespaceSuite` are different from `V2 DropNamespaceSuite`.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] AmplabJenkins commented on pull request #34819: [SPARK-37478][SQL][TESTS] Unify v1 and v2 DROP NAMESPACE tests

Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #34819:
URL: https://github.com/apache/spark/pull/34819#issuecomment-986699054


   
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder-K8s/50423/
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] SparkQA commented on pull request #34819: [SPARK-37478][SQL][TESTS] Unify v1 and v2 DROP NAMESPACE tests

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #34819:
URL: https://github.com/apache/spark/pull/34819#issuecomment-986649959


   Kubernetes integration test starting
   URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/50423/
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] dchvn commented on a change in pull request #34819: [SPARK-33849][SQL][TESTS] Unify v1 and v2 DROP NAMESPACE tests

Posted by GitBox <gi...@apache.org>.
dchvn commented on a change in pull request #34819:
URL: https://github.com/apache/spark/pull/34819#discussion_r762843953



##########
File path: sql/core/src/test/scala/org/apache/spark/sql/execution/command/v1/DropNamespaceSuite.scala
##########
@@ -0,0 +1,71 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.spark.sql.execution.command.v1
+
+import org.apache.spark.sql.AnalysisException
+import org.apache.spark.sql.execution.command
+
+/**
+ * This base suite contains unified tests for the `DROP NAMESPACE` commands that check V1 table
+ * catalogs. The tests that cannot run for all V1 catalogs are located in more specific test
+ * suites:
+ *
+ *   - V1 In-Memory catalog: `org.apache.spark.sql.execution.command.v1.DropNamespaceSuite`
+ *   - V1 Hive External catalog: `org.apache.spark.sql.hive.execution.command.DropNamespaceSuite`
+ */
+trait DropNamespaceSuiteBase extends command.DropNamespaceSuiteBase {
+  override protected def builtinTopNamespaces: Seq[String] = Seq("default")
+
+  test("DropNamespace: drop default namespace") {
+    val message = intercept[AnalysisException] {
+      sql(s"DROP NAMESPACE default")
+    }.getMessage
+    assert(message.contains("Can not drop default database"))
+  }
+
+  test("DropNamespace: drop non-empty namespace with a non-cascading mode") {
+    sql(s"CREATE NAMESPACE $catalog.ns")
+    sql(s"CREATE TABLE $catalog.ns.table (id bigint) $defaultUsing")
+    checkNamespace(s"SHOW NAMESPACES IN $catalog", Seq("ns") ++ builtinTopNamespaces)
+
+    def assertDropFails(): Unit = {
+      val e = intercept[AnalysisException] {
+        sql(s"DROP NAMESPACE $catalog.ns")
+      }
+      assert(e.getMessage.contains("Database ns is not empty. One or more tables exist"))

Review comment:
       The exception and message of test `drop non-empty namespace with a non-cascading mode` that throw in `V1 DropNamespaceSuite` are different from `V2 DropNamespaceSuite`.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] SparkQA commented on pull request #34819: [SPARK-37478][SQL][TESTS] Unify v1 and v2 DROP NAMESPACE tests

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #34819:
URL: https://github.com/apache/spark/pull/34819#issuecomment-986682238


   Kubernetes integration test status failure
   URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/50423/
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] cloud-fan commented on a change in pull request #34819: [SPARK-37478][SQL][TESTS] Unify v1 and v2 DROP NAMESPACE tests

Posted by GitBox <gi...@apache.org>.
cloud-fan commented on a change in pull request #34819:
URL: https://github.com/apache/spark/pull/34819#discussion_r763629569



##########
File path: sql/core/src/test/scala/org/apache/spark/sql/execution/command/v2/DropNamespaceSuite.scala
##########
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.spark.sql.execution.command.v2
+
+import org.apache.spark.SparkException
+import org.apache.spark.sql.execution.command
+
+/**
+ * The class contains tests for the `DROP NAMESPACE` command to check V2 table catalogs.
+ */
+class DropNamespaceSuite extends command.DropNamespaceSuiteBase with CommandSuiteBase {
+  override protected def assertDropFails(): Unit = {
+    val e = intercept[SparkException] {

Review comment:
       Can we leave a TODO to unify the error? I think both v1 and v2 commands should throw `AnalysisException`, and the error message should only have one difference between v1 and v2: `Cannot drop a non-empty namespace: ...` vs `Cannot drop a non-empty database: ...`




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] AmplabJenkins removed a comment on pull request #34819: [SPARK-37478][SQL][TESTS] Unify v1 and v2 DROP NAMESPACE tests

Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #34819:
URL: https://github.com/apache/spark/pull/34819#issuecomment-987700306


   
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/145971/
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] AmplabJenkins removed a comment on pull request #34819: [SPARK-37478][SQL][TESTS] Unify v1 and v2 DROP NAMESPACE tests

Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #34819:
URL: https://github.com/apache/spark/pull/34819#issuecomment-987895053


   
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/145980/
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] cloud-fan commented on pull request #34819: [SPARK-37478][SQL][TESTS] Unify v1 and v2 DROP NAMESPACE tests

Posted by GitBox <gi...@apache.org>.
cloud-fan commented on pull request #34819:
URL: https://github.com/apache/spark/pull/34819#issuecomment-987896107


   thanks, merging to master!


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] SparkQA removed a comment on pull request #34819: [SPARK-37478][SQL][TESTS] Unify v1 and v2 DROP NAMESPACE tests

Posted by GitBox <gi...@apache.org>.
SparkQA removed a comment on pull request #34819:
URL: https://github.com/apache/spark/pull/34819#issuecomment-987659072


   **[Test build #145980 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/145980/testReport)** for PR 34819 at commit [`980e2be`](https://github.com/apache/spark/commit/980e2bef44448d94d990ff91ac8c8fa3db75024d).


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org