Github user gatorsmile commented on a diff in the pull request:

    https://github.com/apache/spark/pull/12812#discussion_r61679067
  
    --- Diff: 
sql/core/src/test/scala/org/apache/spark/sql/execution/command/DDLSuite.scala 
---
    @@ -83,6 +93,29 @@ class DDLSuite extends QueryTest with SharedSQLContext 
with BeforeAndAfterEach {
         catalog.createPartitions(tableName, Seq(part), ignoreIfExists = false)
       }
     
    +  test("the qualified path of a database is stored in the catalog") {
    +    val catalog = sqlContext.sessionState.catalog
    +
    +    val path = System.getProperty("java.io.tmpdir")
    +    // The generated temp path is not qualified.
    +    assert(!path.startsWith("file:/"))
    +    sql(s"CREATE DATABASE db1 LOCATION '$path'")
    +    val pathInCatalog = new 
Path(catalog.getDatabaseMetadata("db1").locationUri).toUri
    +    assert("file" === pathInCatalog.getScheme)
    +    assert(path === pathInCatalog.getPath)
    +
    +    withSQLConf(
    +      SQLConf.WAREHOUSE_PATH.key -> 
(System.getProperty("java.io.tmpdir"))) {
    +      sql(s"CREATE DATABASE db2")
    +      val pathInCatalog = new 
Path(catalog.getDatabaseMetadata("db2").locationUri).toUri
    +      assert("file" === pathInCatalog.getScheme)
    +      assert(s"${sqlContext.conf.warehousePath}/db2.db" === 
pathInCatalog.getPath)
    +    }
    +
    +    sql("DROP DATABASE db1")
    +    sql("DROP DATABASE db2")
    +  }
    +
       test("Create/Drop Database") {
         withSQLConf(
             SQLConf.WAREHOUSE_PATH.key -> 
(System.getProperty("java.io.tmpdir") + File.separator)) {
    --- End diff --
    
    Yeah, you are right. Thanks for the suggestion!


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to