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

    https://github.com/apache/spark/pull/17001#discussion_r104101806
  
    --- Diff: 
sql/hive/src/test/scala/org/apache/spark/sql/hive/HiveSparkSubmitSuite.scala ---
    @@ -905,3 +934,91 @@ object SPARK_18989_DESC_TABLE {
         }
       }
     }
    +
    +object SPARK_19667_CREATE_TABLE {
    +  def main(args: Array[String]): Unit = {
    +    val spark = SparkSession.builder().enableHiveSupport().getOrCreate()
    +    try {
    +      val warehousePath = 
s"file:${spark.sharedState.warehousePath.stripSuffix("/")}"
    +      val defaultDB = 
spark.sessionState.catalog.getDatabaseMetadata("default")
    +      // default database use warehouse path as its location
    +      assert(defaultDB.locationUri.stripSuffix("/") == warehousePath)
    +      spark.sql("CREATE TABLE t(a string)")
    +
    +      val table = 
spark.sessionState.catalog.getTableMetadata(TableIdentifier("t"))
    +      // table in default database use the location of default database 
which is also warehouse path
    +      assert(table.location.stripSuffix("/") == s"$warehousePath/t")
    +      spark.sql("INSERT INTO TABLE t SELECT 1")
    +      assert(spark.sql("SELECT * FROM t").count == 1)
    +
    +      spark.sql("CREATE DATABASE not_default")
    +      spark.sql("USE not_default")
    +      spark.sql("CREATE TABLE t1(b string)")
    +      val table1 = 
spark.sessionState.catalog.getTableMetadata(TableIdentifier("t1"))
    +      // table in not default database use the location of its own database
    +      assert(table1.location.stripSuffix("/") == 
s"$warehousePath/not_default.db/t1")
    +    } finally {
    +      spark.sql("USE default")
    +    }
    +  }
    +}
    +
    +object SPARK_19667_VERIFY_TABLE_PATH {
    +  def main(args: Array[String]): Unit = {
    +    val spark = SparkSession.builder().enableHiveSupport().getOrCreate()
    +    try {
    +      val warehousePath = 
s"file:${spark.sharedState.warehousePath.stripSuffix("/")}"
    --- End diff --
    
    I am doing this modify


---
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