Uploaded image for project: 'Spark'
  1. Spark
  2. SPARK-32156

Refactor two similar test cases from SPARK-31061 in HiveExternalCatalogSuite

    XMLWordPrintableJSON

    Details

    • Type: Test
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 3.0.0
    • Fix Version/s: 3.1.0
    • Component/s: Tests
    • Labels:
      None

      Description

      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")) }

      `

       

        Attachments

          Activity

            People

            • Assignee:
              JinxinTang JinxinTang
              Reporter:
              JinxinTang JinxinTang
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: