You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "JinxinTang (Jira)" <ji...@apache.org> on 2020/07/02 09:59:00 UTC

[jira] [Created] (SPARK-32156) SPARK-31061 has two very similar tests could merge and somewhere could be improved

JinxinTang created SPARK-32156:
----------------------------------

             Summary: SPARK-31061 has two very similar tests could merge and somewhere could be improved
                 Key: SPARK-32156
                 URL: https://issues.apache.org/jira/browse/SPARK-32156
             Project: Spark
          Issue Type: Test
          Components: Tests
    Affects Versions: 3.0.0
            Reporter: JinxinTang
             Fix For: 3.0.0


In `org.apache.spark.sql.hive.HiveExternalCatalogSuite`

`

test("SPARK-31061: alterTable should be able to change table provider") {
 val catalog = newBasicCatalog()
 val parquetTable = CatalogTable(
 identifier = TableIdentifier("parq_tbl", Some("db1")),
 tableType = CatalogTableType.MANAGED,
 storage = storageFormat.copy(locationUri = Some(new URI("file:/some/path"))),
 schema = new StructType().add("col1", "int").add("col2", "string"),
 provider = Some("parquet"))
 catalog.createTable(parquetTable, ignoreIfExists = false)

 val rawTable = externalCatalog.getTable("db1", "parq_tbl")
 assert(rawTable.provider === Some("parquet"))

 val fooTable = *parquetTable*.copy(provider = Some("foo")) <- `*parquetTable*` seems should be rawTable
 catalog.alterTable(fooTable)
 val alteredTable = externalCatalog.getTable("db1", "parq_tbl")
 assert(alteredTable.provider === Some("foo"))
}

test("SPARK-31061: alterTable should be able to change table provider from hive") {
 val catalog = newBasicCatalog()
 val hiveTable = CatalogTable(
 identifier = TableIdentifier("parq_tbl", Some("db1")),
 tableType = CatalogTableType.MANAGED,
 storage = storageFormat,
 schema = new StructType().add("col1", "int").add("col2", "string"),
 provider = Some("hive"))
 catalog.createTable(hiveTable, ignoreIfExists = false)

 val rawTable = externalCatalog.getTable("db1", "parq_tbl")
 assert(rawTable.provider === Some("hive"))

 val fooTable = rawTable.copy(provider = Some("foo"))
 catalog.alterTable(fooTable)
 val alteredTable = externalCatalog.getTable("db1", "parq_tbl")
 assert(alteredTable.provider === Some("foo"))
}

`

 



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

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