From 65fd9c3b9e0208f39f7f1b1831c78c8be7c20d47 Mon Sep 17 00:00:00 2001 From: Max Gekk Date: Wed, 11 Nov 2020 22:25:04 +0300 Subject: [PATCH 1/7] Add Hive ShowTablesSuite --- .../execution/command/ShowTablesSuite.scala | 1 + .../sql/hive/execution/HiveCommandSuite.scala | 22 --------- .../execution/command/ShowTablesSuite.scala | 49 +++++++++++++++++++ 3 files changed, 50 insertions(+), 22 deletions(-) create mode 100644 sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/command/ShowTablesSuite.scala diff --git a/sql/core/src/test/scala/org/apache/spark/sql/execution/command/ShowTablesSuite.scala b/sql/core/src/test/scala/org/apache/spark/sql/execution/command/ShowTablesSuite.scala index 01720b5723243..b2cb252b587d0 100644 --- a/sql/core/src/test/scala/org/apache/spark/sql/execution/command/ShowTablesSuite.scala +++ b/sql/core/src/test/scala/org/apache/spark/sql/execution/command/ShowTablesSuite.scala @@ -116,6 +116,7 @@ trait ShowTablesSuite extends SharedSparkSession { // Update the current namespace to match "ns.tbl". sql(s"USE $catalog.ns") runShowTablesSql("SHOW TABLES", Seq(ShowRow("ns", "table", false))) + sql(s"USE default") } } } diff --git a/sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/HiveCommandSuite.scala b/sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/HiveCommandSuite.scala index dcec8bf5c0cc6..a78fd506b752e 100644 --- a/sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/HiveCommandSuite.scala +++ b/sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/HiveCommandSuite.scala @@ -95,28 +95,6 @@ class HiveCommandSuite extends QueryTest with SQLTestUtils with TestHiveSingleto } } - test("show tables") { - withTable("show1a", "show2b") { - sql("CREATE TABLE show1a(c1 int)") - sql("CREATE TABLE show2b(c2 int)") - checkAnswer( - sql("SHOW TABLES IN default 'show1*'"), - Row("default", "show1a", false) :: Nil) - checkAnswer( - sql("SHOW TABLES IN default 'show1*|show2*'"), - Row("default", "show1a", false) :: - Row("default", "show2b", false) :: Nil) - checkAnswer( - sql("SHOW TABLES 'show1*|show2*'"), - Row("default", "show1a", false) :: - Row("default", "show2b", false) :: Nil) - assert( - sql("SHOW TABLES").count() >= 2) - assert( - sql("SHOW TABLES IN default").count() >= 2) - } - } - test("show views") { withView("show1a", "show2b", "global_temp.temp1", "temp2") { sql("CREATE VIEW show1a AS SELECT 1 AS id") diff --git a/sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/command/ShowTablesSuite.scala b/sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/command/ShowTablesSuite.scala new file mode 100644 index 0000000000000..ba2f914d1ccb1 --- /dev/null +++ b/sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/command/ShowTablesSuite.scala @@ -0,0 +1,49 @@ +/* + * 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.hive.execution.command + +import org.apache.spark.sql.SparkSession +import org.apache.spark.sql.execution.command.v1 +import org.apache.spark.sql.hive.test.TestHive + +class ShowTablesSuite extends v1.ShowTablesSuite { + override def version: String = "Hive V1" + override def defaultUsing: String = "USING HIVE" + override protected val spark: SparkSession = TestHive.sparkSession + protected override def beforeAll(): Unit = {} + + test("show Hive tables") { + withTable("show1a", "show2b") { + sql("CREATE TABLE show1a(c1 int)") + sql("CREATE TABLE show2b(c2 int)") + runShowTablesSql( + "SHOW TABLES IN default 'show1*'", + ShowRow("default", "show1a", false) :: Nil) + runShowTablesSql( + "SHOW TABLES IN default 'show1*|show2*'", + ShowRow("default", "show1a", false) :: + ShowRow("default", "show2b", false) :: Nil) + runShowTablesSql( + "SHOW TABLES 'show1*|show2*'", + ShowRow("default", "show1a", false) :: + ShowRow("default", "show2b", false) :: Nil) + assert(sql("SHOW TABLES").count() >= 2) + assert(sql("SHOW TABLES IN default").count() >= 2) + } + } +} From 4fb6ddcac7ae9fa12a2f6456c96fa016ce59e8cc Mon Sep 17 00:00:00 2001 From: Max Gekk Date: Wed, 11 Nov 2020 22:34:35 +0300 Subject: [PATCH 2/7] Set the default namespace --- .../apache/spark/sql/execution/command/ShowTablesSuite.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sql/core/src/test/scala/org/apache/spark/sql/execution/command/ShowTablesSuite.scala b/sql/core/src/test/scala/org/apache/spark/sql/execution/command/ShowTablesSuite.scala index b2cb252b587d0..f10d9a71a8b31 100644 --- a/sql/core/src/test/scala/org/apache/spark/sql/execution/command/ShowTablesSuite.scala +++ b/sql/core/src/test/scala/org/apache/spark/sql/execution/command/ShowTablesSuite.scala @@ -116,7 +116,7 @@ trait ShowTablesSuite extends SharedSparkSession { // Update the current namespace to match "ns.tbl". sql(s"USE $catalog.ns") runShowTablesSql("SHOW TABLES", Seq(ShowRow("ns", "table", false))) - sql(s"USE default") + defaultNamespace.headOption.foreach(ns => sql(s"USE $ns")) } } } From 8dfd9c705958d4eb5e2183afb0971ee300c74af2 Mon Sep 17 00:00:00 2001 From: Max Gekk Date: Thu, 12 Nov 2020 10:51:44 +0300 Subject: [PATCH 3/7] Move Hive tests to the common trait --- .../execution/command/ShowTablesSuite.scala | 34 ++++++++++--------- .../execution/command/ShowTablesSuite.scala | 20 ----------- 2 files changed, 18 insertions(+), 36 deletions(-) diff --git a/sql/core/src/test/scala/org/apache/spark/sql/execution/command/ShowTablesSuite.scala b/sql/core/src/test/scala/org/apache/spark/sql/execution/command/ShowTablesSuite.scala index f10d9a71a8b31..00cf039ef5a5b 100644 --- a/sql/core/src/test/scala/org/apache/spark/sql/execution/command/ShowTablesSuite.scala +++ b/sql/core/src/test/scala/org/apache/spark/sql/execution/command/ShowTablesSuite.scala @@ -39,7 +39,7 @@ trait ShowTablesSuite extends SharedSparkSession { protected def runShowTablesSql(sqlText: String, expected: Seq[ShowRow]): Unit = { val df = spark.sql(sqlText) assert(df.schema === showSchema) - assert(df.collect() === getRows(expected)) + assert(df.collect().toSet === getRows(expected).toSet) } override def test(testName: String, testTags: Tag*)(testFun: => Any) @@ -58,35 +58,38 @@ trait ShowTablesSuite extends SharedSparkSession { } test("show tables with a pattern") { - withNamespace(s"$catalog.ns1", s"$catalog.ns2") { + withNamespace(s"$catalog.ns1") { sql(s"CREATE NAMESPACE $catalog.ns1") - sql(s"CREATE NAMESPACE $catalog.ns2") withTable( s"$catalog.ns1.table", - s"$catalog.ns1.table_name_1", - s"$catalog.ns1.table_name_2", - s"$catalog.ns2.table_name_2") { + s"$catalog.ns1.table_name_1a", + s"$catalog.ns1.table_name_2b") { sql(s"CREATE TABLE $catalog.ns1.table (id bigint, data string) $defaultUsing") - sql(s"CREATE TABLE $catalog.ns1.table_name_1 (id bigint, data string) $defaultUsing") - sql(s"CREATE TABLE $catalog.ns1.table_name_2 (id bigint, data string) $defaultUsing") - sql(s"CREATE TABLE $catalog.ns2.table_name_2 (id bigint, data string) $defaultUsing") + sql(s"CREATE TABLE $catalog.ns1.table_name_1a (id bigint, data string) $defaultUsing") + sql(s"CREATE TABLE $catalog.ns1.table_name_2b (id bigint, data string) $defaultUsing") runShowTablesSql( s"SHOW TABLES FROM $catalog.ns1", Seq( ShowRow("ns1", "table", false), - ShowRow("ns1", "table_name_1", false), - ShowRow("ns1", "table_name_2", false))) + ShowRow("ns1", "table_name_1a", false), + ShowRow("ns1", "table_name_2b", false))) runShowTablesSql( s"SHOW TABLES FROM $catalog.ns1 LIKE '*name*'", Seq( - ShowRow("ns1", "table_name_1", false), - ShowRow("ns1", "table_name_2", false))) + ShowRow("ns1", "table_name_1a", false), + ShowRow("ns1", "table_name_2b", false))) runShowTablesSql( - s"SHOW TABLES FROM $catalog.ns1 LIKE '*2'", - Seq(ShowRow("ns1", "table_name_2", false))) + s"SHOW TABLES FROM $catalog.ns1 LIKE 'table_name_1*|table_name_2*'", + Seq( + ShowRow("ns1", "table_name_1a", false), + ShowRow("ns1", "table_name_2b", false))) + + runShowTablesSql( + s"SHOW TABLES FROM $catalog.ns1 LIKE '*2b'", + Seq(ShowRow("ns1", "table_name_2b", false))) } } } @@ -116,7 +119,6 @@ trait ShowTablesSuite extends SharedSparkSession { // Update the current namespace to match "ns.tbl". sql(s"USE $catalog.ns") runShowTablesSql("SHOW TABLES", Seq(ShowRow("ns", "table", false))) - defaultNamespace.headOption.foreach(ns => sql(s"USE $ns")) } } } diff --git a/sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/command/ShowTablesSuite.scala b/sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/command/ShowTablesSuite.scala index ba2f914d1ccb1..335b7eb88fad3 100644 --- a/sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/command/ShowTablesSuite.scala +++ b/sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/command/ShowTablesSuite.scala @@ -26,24 +26,4 @@ class ShowTablesSuite extends v1.ShowTablesSuite { override def defaultUsing: String = "USING HIVE" override protected val spark: SparkSession = TestHive.sparkSession protected override def beforeAll(): Unit = {} - - test("show Hive tables") { - withTable("show1a", "show2b") { - sql("CREATE TABLE show1a(c1 int)") - sql("CREATE TABLE show2b(c2 int)") - runShowTablesSql( - "SHOW TABLES IN default 'show1*'", - ShowRow("default", "show1a", false) :: Nil) - runShowTablesSql( - "SHOW TABLES IN default 'show1*|show2*'", - ShowRow("default", "show1a", false) :: - ShowRow("default", "show2b", false) :: Nil) - runShowTablesSql( - "SHOW TABLES 'show1*|show2*'", - ShowRow("default", "show1a", false) :: - ShowRow("default", "show2b", false) :: Nil) - assert(sql("SHOW TABLES").count() >= 2) - assert(sql("SHOW TABLES IN default").count() >= 2) - } - } } From c856b895c43e8f7630bc4fd3f1822c8f0498490e Mon Sep 17 00:00:00 2001 From: Max Gekk Date: Thu, 12 Nov 2020 11:28:09 +0300 Subject: [PATCH 4/7] Revert back ns2 in a test --- .../spark/sql/execution/command/ShowTablesSuite.scala | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/sql/core/src/test/scala/org/apache/spark/sql/execution/command/ShowTablesSuite.scala b/sql/core/src/test/scala/org/apache/spark/sql/execution/command/ShowTablesSuite.scala index 00cf039ef5a5b..77a81db999446 100644 --- a/sql/core/src/test/scala/org/apache/spark/sql/execution/command/ShowTablesSuite.scala +++ b/sql/core/src/test/scala/org/apache/spark/sql/execution/command/ShowTablesSuite.scala @@ -58,15 +58,18 @@ trait ShowTablesSuite extends SharedSparkSession { } test("show tables with a pattern") { - withNamespace(s"$catalog.ns1") { + withNamespace(s"$catalog.ns1", s"$catalog.ns2") { sql(s"CREATE NAMESPACE $catalog.ns1") + sql(s"CREATE NAMESPACE $catalog.ns2") withTable( s"$catalog.ns1.table", s"$catalog.ns1.table_name_1a", - s"$catalog.ns1.table_name_2b") { + s"$catalog.ns1.table_name_2b", + s"$catalog.ns2.table_name_2b") { sql(s"CREATE TABLE $catalog.ns1.table (id bigint, data string) $defaultUsing") sql(s"CREATE TABLE $catalog.ns1.table_name_1a (id bigint, data string) $defaultUsing") sql(s"CREATE TABLE $catalog.ns1.table_name_2b (id bigint, data string) $defaultUsing") + sql(s"CREATE TABLE $catalog.ns2.table_name_2b (id bigint, data string) $defaultUsing") runShowTablesSql( s"SHOW TABLES FROM $catalog.ns1", From fb7456688b98cab64e7e6f5f5d0a5be529f05b25 Mon Sep 17 00:00:00 2001 From: Max Gekk Date: Thu, 12 Nov 2020 11:34:56 +0300 Subject: [PATCH 5/7] Use checkAnswer() in runShowTablesSql() --- .../spark/sql/execution/command/ShowTablesSuite.scala | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sql/core/src/test/scala/org/apache/spark/sql/execution/command/ShowTablesSuite.scala b/sql/core/src/test/scala/org/apache/spark/sql/execution/command/ShowTablesSuite.scala index 77a81db999446..ee0f40ef845a6 100644 --- a/sql/core/src/test/scala/org/apache/spark/sql/execution/command/ShowTablesSuite.scala +++ b/sql/core/src/test/scala/org/apache/spark/sql/execution/command/ShowTablesSuite.scala @@ -20,13 +20,13 @@ package org.apache.spark.sql.execution.command import org.scalactic.source.Position import org.scalatest.Tag -import org.apache.spark.sql.Row +import org.apache.spark.sql.{QueryTest, Row} import org.apache.spark.sql.connector.catalog.CatalogV2Implicits._ import org.apache.spark.sql.internal.SQLConf import org.apache.spark.sql.test.SharedSparkSession import org.apache.spark.sql.types.StructType -trait ShowTablesSuite extends SharedSparkSession { +trait ShowTablesSuite extends QueryTest with SharedSparkSession { protected def version: String protected def catalog: String protected def defaultNamespace: Seq[String] @@ -39,7 +39,7 @@ trait ShowTablesSuite extends SharedSparkSession { protected def runShowTablesSql(sqlText: String, expected: Seq[ShowRow]): Unit = { val df = spark.sql(sqlText) assert(df.schema === showSchema) - assert(df.collect().toSet === getRows(expected).toSet) + checkAnswer(df, getRows(expected)) } override def test(testName: String, testTags: Tag*)(testFun: => Any) From bd0f7856f39da3da62cf1b17a33bc10e0a593bc2 Mon Sep 17 00:00:00 2001 From: Max Gekk Date: Thu, 12 Nov 2020 14:26:18 +0300 Subject: [PATCH 6/7] Avoid the hask with overriding the beforeAll() method --- .../spark/sql/execution/command/ShowTablesSuite.scala | 4 ++-- .../spark/sql/execution/command/v1/ShowTablesSuite.scala | 5 ++++- .../spark/sql/execution/command/v2/ShowTablesSuite.scala | 3 ++- .../spark/sql/hive/execution/command/ShowTablesSuite.scala | 7 ++----- 4 files changed, 10 insertions(+), 9 deletions(-) diff --git a/sql/core/src/test/scala/org/apache/spark/sql/execution/command/ShowTablesSuite.scala b/sql/core/src/test/scala/org/apache/spark/sql/execution/command/ShowTablesSuite.scala index ee0f40ef845a6..8355c4376aa6a 100644 --- a/sql/core/src/test/scala/org/apache/spark/sql/execution/command/ShowTablesSuite.scala +++ b/sql/core/src/test/scala/org/apache/spark/sql/execution/command/ShowTablesSuite.scala @@ -23,10 +23,10 @@ import org.scalatest.Tag import org.apache.spark.sql.{QueryTest, Row} import org.apache.spark.sql.connector.catalog.CatalogV2Implicits._ import org.apache.spark.sql.internal.SQLConf -import org.apache.spark.sql.test.SharedSparkSession +import org.apache.spark.sql.test.SQLTestUtils import org.apache.spark.sql.types.StructType -trait ShowTablesSuite extends QueryTest with SharedSparkSession { +trait ShowTablesSuite extends QueryTest with SQLTestUtils { protected def version: String protected def catalog: String protected def defaultNamespace: Seq[String] diff --git a/sql/core/src/test/scala/org/apache/spark/sql/execution/command/v1/ShowTablesSuite.scala b/sql/core/src/test/scala/org/apache/spark/sql/execution/command/v1/ShowTablesSuite.scala index feb3bc623f3fa..aad5f91f0e778 100644 --- a/sql/core/src/test/scala/org/apache/spark/sql/execution/command/v1/ShowTablesSuite.scala +++ b/sql/core/src/test/scala/org/apache/spark/sql/execution/command/v1/ShowTablesSuite.scala @@ -21,9 +21,10 @@ import org.apache.spark.sql.{AnalysisException, Row} import org.apache.spark.sql.catalyst.analysis.NoSuchDatabaseException import org.apache.spark.sql.connector.catalog.CatalogManager import org.apache.spark.sql.execution.command.{ShowTablesSuite => CommonShowTablesSuite} +import org.apache.spark.sql.test.SharedSparkSession import org.apache.spark.sql.types.{BooleanType, StringType, StructType} -class ShowTablesSuite extends CommonShowTablesSuite { +trait ShowTablesTests extends CommonShowTablesSuite { override def version: String = "V1" override def catalog: String = CatalogManager.SESSION_CATALOG_NAME override def defaultNamespace: Seq[String] = Seq("default") @@ -93,3 +94,5 @@ class ShowTablesSuite extends CommonShowTablesSuite { } } } + +class ShowTablesSuite extends ShowTablesTests with SharedSparkSession diff --git a/sql/core/src/test/scala/org/apache/spark/sql/execution/command/v2/ShowTablesSuite.scala b/sql/core/src/test/scala/org/apache/spark/sql/execution/command/v2/ShowTablesSuite.scala index 668120ae1cada..c9d560fb2d1ee 100644 --- a/sql/core/src/test/scala/org/apache/spark/sql/execution/command/v2/ShowTablesSuite.scala +++ b/sql/core/src/test/scala/org/apache/spark/sql/execution/command/v2/ShowTablesSuite.scala @@ -22,9 +22,10 @@ import org.apache.spark.sql.{AnalysisException, Row} import org.apache.spark.sql.catalyst.analysis.NoSuchDatabaseException import org.apache.spark.sql.connector.InMemoryTableCatalog import org.apache.spark.sql.execution.command.{ShowTablesSuite => CommonShowTablesSuite} +import org.apache.spark.sql.test.SharedSparkSession import org.apache.spark.sql.types.{StringType, StructType} -class ShowTablesSuite extends CommonShowTablesSuite { +class ShowTablesSuite extends CommonShowTablesSuite with SharedSparkSession { override def version: String = "V2" override def catalog: String = "test_catalog" override def defaultNamespace: Seq[String] = Nil diff --git a/sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/command/ShowTablesSuite.scala b/sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/command/ShowTablesSuite.scala index 335b7eb88fad3..7175039e36cda 100644 --- a/sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/command/ShowTablesSuite.scala +++ b/sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/command/ShowTablesSuite.scala @@ -17,13 +17,10 @@ package org.apache.spark.sql.hive.execution.command -import org.apache.spark.sql.SparkSession import org.apache.spark.sql.execution.command.v1 -import org.apache.spark.sql.hive.test.TestHive +import org.apache.spark.sql.hive.test.TestHiveSingleton -class ShowTablesSuite extends v1.ShowTablesSuite { +class ShowTablesSuite extends v1.ShowTablesTests with TestHiveSingleton { override def version: String = "Hive V1" override def defaultUsing: String = "USING HIVE" - override protected val spark: SparkSession = TestHive.sparkSession - protected override def beforeAll(): Unit = {} } From 7eab687f86463fc09a70ce8ad41e22595b23e82a Mon Sep 17 00:00:00 2001 From: Max Gekk Date: Thu, 12 Nov 2020 14:48:44 +0300 Subject: [PATCH 7/7] Refactoring: rename classes/traits --- .../{ShowTablesSuite.scala => ShowTablesSuiteBase.scala} | 2 +- .../spark/sql/execution/command/v1/ShowTablesSuite.scala | 6 +++--- .../spark/sql/execution/command/v2/ShowTablesSuite.scala | 4 ++-- .../spark/sql/hive/execution/command/ShowTablesSuite.scala | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) rename sql/core/src/test/scala/org/apache/spark/sql/execution/command/{ShowTablesSuite.scala => ShowTablesSuiteBase.scala} (98%) diff --git a/sql/core/src/test/scala/org/apache/spark/sql/execution/command/ShowTablesSuite.scala b/sql/core/src/test/scala/org/apache/spark/sql/execution/command/ShowTablesSuiteBase.scala similarity index 98% rename from sql/core/src/test/scala/org/apache/spark/sql/execution/command/ShowTablesSuite.scala rename to sql/core/src/test/scala/org/apache/spark/sql/execution/command/ShowTablesSuiteBase.scala index 8355c4376aa6a..49428fab79027 100644 --- a/sql/core/src/test/scala/org/apache/spark/sql/execution/command/ShowTablesSuite.scala +++ b/sql/core/src/test/scala/org/apache/spark/sql/execution/command/ShowTablesSuiteBase.scala @@ -26,7 +26,7 @@ import org.apache.spark.sql.internal.SQLConf import org.apache.spark.sql.test.SQLTestUtils import org.apache.spark.sql.types.StructType -trait ShowTablesSuite extends QueryTest with SQLTestUtils { +trait ShowTablesSuiteBase extends QueryTest with SQLTestUtils { protected def version: String protected def catalog: String protected def defaultNamespace: Seq[String] diff --git a/sql/core/src/test/scala/org/apache/spark/sql/execution/command/v1/ShowTablesSuite.scala b/sql/core/src/test/scala/org/apache/spark/sql/execution/command/v1/ShowTablesSuite.scala index aad5f91f0e778..d2332818d9546 100644 --- a/sql/core/src/test/scala/org/apache/spark/sql/execution/command/v1/ShowTablesSuite.scala +++ b/sql/core/src/test/scala/org/apache/spark/sql/execution/command/v1/ShowTablesSuite.scala @@ -20,11 +20,11 @@ package org.apache.spark.sql.execution.command.v1 import org.apache.spark.sql.{AnalysisException, Row} import org.apache.spark.sql.catalyst.analysis.NoSuchDatabaseException import org.apache.spark.sql.connector.catalog.CatalogManager -import org.apache.spark.sql.execution.command.{ShowTablesSuite => CommonShowTablesSuite} +import org.apache.spark.sql.execution.command import org.apache.spark.sql.test.SharedSparkSession import org.apache.spark.sql.types.{BooleanType, StringType, StructType} -trait ShowTablesTests extends CommonShowTablesSuite { +trait ShowTablesSuiteBase extends command.ShowTablesSuiteBase { override def version: String = "V1" override def catalog: String = CatalogManager.SESSION_CATALOG_NAME override def defaultNamespace: Seq[String] = Seq("default") @@ -95,4 +95,4 @@ trait ShowTablesTests extends CommonShowTablesSuite { } } -class ShowTablesSuite extends ShowTablesTests with SharedSparkSession +class ShowTablesSuite extends ShowTablesSuiteBase with SharedSparkSession diff --git a/sql/core/src/test/scala/org/apache/spark/sql/execution/command/v2/ShowTablesSuite.scala b/sql/core/src/test/scala/org/apache/spark/sql/execution/command/v2/ShowTablesSuite.scala index c9d560fb2d1ee..c7f68863a1791 100644 --- a/sql/core/src/test/scala/org/apache/spark/sql/execution/command/v2/ShowTablesSuite.scala +++ b/sql/core/src/test/scala/org/apache/spark/sql/execution/command/v2/ShowTablesSuite.scala @@ -21,11 +21,11 @@ import org.apache.spark.SparkConf import org.apache.spark.sql.{AnalysisException, Row} import org.apache.spark.sql.catalyst.analysis.NoSuchDatabaseException import org.apache.spark.sql.connector.InMemoryTableCatalog -import org.apache.spark.sql.execution.command.{ShowTablesSuite => CommonShowTablesSuite} +import org.apache.spark.sql.execution.command import org.apache.spark.sql.test.SharedSparkSession import org.apache.spark.sql.types.{StringType, StructType} -class ShowTablesSuite extends CommonShowTablesSuite with SharedSparkSession { +class ShowTablesSuite extends command.ShowTablesSuiteBase with SharedSparkSession { override def version: String = "V2" override def catalog: String = "test_catalog" override def defaultNamespace: Seq[String] = Nil diff --git a/sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/command/ShowTablesSuite.scala b/sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/command/ShowTablesSuite.scala index 7175039e36cda..836f080d28e75 100644 --- a/sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/command/ShowTablesSuite.scala +++ b/sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/command/ShowTablesSuite.scala @@ -20,7 +20,7 @@ package org.apache.spark.sql.hive.execution.command import org.apache.spark.sql.execution.command.v1 import org.apache.spark.sql.hive.test.TestHiveSingleton -class ShowTablesSuite extends v1.ShowTablesTests with TestHiveSingleton { +class ShowTablesSuite extends v1.ShowTablesSuiteBase with TestHiveSingleton { override def version: String = "Hive V1" override def defaultUsing: String = "USING HIVE" }