rdblue commented on a change in pull request #25363: [SPARK-28628][SQL] Implement SupportsNamespaces in V2SessionCatalog URL: https://github.com/apache/spark/pull/25363#discussion_r319693755
########## File path: sql/core/src/test/scala/org/apache/spark/sql/execution/datasources/v2/V2SessionCatalogSuite.scala ########## @@ -22,41 +22,55 @@ import java.util.Collections import scala.collection.JavaConverters._ -import org.scalatest.{BeforeAndAfter, BeforeAndAfterAll} +import org.scalatest.BeforeAndAfter import org.apache.spark.SparkFunSuite import org.apache.spark.sql.AnalysisException -import org.apache.spark.sql.catalog.v2.{Catalogs, Identifier, TableCatalog, TableChange} -import org.apache.spark.sql.catalyst.analysis.{NoSuchTableException, TableAlreadyExistsException} +import org.apache.spark.sql.catalog.v2.{Catalogs, Identifier, NamespaceChange, TableChange} +import org.apache.spark.sql.catalyst.analysis.{NamespaceAlreadyExistsException, NoSuchNamespaceException, NoSuchTableException, TableAlreadyExistsException} import org.apache.spark.sql.catalyst.parser.CatalystSqlParser import org.apache.spark.sql.internal.SQLConf import org.apache.spark.sql.test.SharedSparkSession import org.apache.spark.sql.types.{DoubleType, IntegerType, LongType, StringType, StructField, StructType, TimestampType} import org.apache.spark.sql.util.CaseInsensitiveStringMap -class V2SessionCatalogSuite - extends SparkFunSuite with SharedSparkSession with BeforeAndAfter { - import org.apache.spark.sql.catalog.v2.CatalogV2Implicits._ +class V2SessionCatalogSuite extends SparkFunSuite with SharedSparkSession with BeforeAndAfter { - private val emptyProps: util.Map[String, String] = Collections.emptyMap[String, String] - private val schema: StructType = new StructType() + val emptyProps: util.Map[String, String] = Collections.emptyMap[String, String] + val schema: StructType = new StructType() .add("id", IntegerType) .add("data", StringType) + val testNs: Array[String] = Array("db") + val defaultNs: Array[String] = Array("default") + val testIdent: Identifier = Identifier.of(testNs, "test_table") + + def newCatalog(): V2SessionCatalog = { + val newCatalog = new V2SessionCatalog(spark.sessionState) + newCatalog.initialize("test", CaseInsensitiveStringMap.empty()) + newCatalog + } +} + +class V2SessionCatalogTableSuite extends V2SessionCatalogSuite { + + import org.apache.spark.sql.catalog.v2.CatalogV2Implicits._ + override protected def beforeAll(): Unit = { super.beforeAll() - spark.sql("""CREATE DATABASE IF NOT EXISTS db""") - spark.sql("""CREATE DATABASE IF NOT EXISTS db2""") - spark.sql("""CREATE DATABASE IF NOT EXISTS ns""") - spark.sql("""CREATE DATABASE IF NOT EXISTS ns2""") + val catalog = newCatalog() + catalog.createNamespace(Array("db"), emptyProps) Review comment: Done. ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org