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

    https://github.com/apache/spark/pull/17524#discussion_r114080240
  
    --- Diff: 
sql/core/src/test/scala/org/apache/spark/sql/execution/command/DDLSuite.scala 
---
    @@ -1837,22 +1805,25 @@ abstract class DDLSuite extends QueryTest with 
SQLTestUtils {
             checkAnswer(spark.table("tbl"), Row(1))
             val defaultTablePath = spark.sessionState.catalog
               .getTableMetadata(TableIdentifier("tbl")).storage.locationUri.get
    -
    -        sql(s"ALTER TABLE tbl SET LOCATION '${dir.toURI}'")
    -        spark.catalog.refreshTable("tbl")
    -        // SET LOCATION won't move data from previous table path to new 
table path.
    -        assert(spark.table("tbl").count() == 0)
    -        // the previous table path should be still there.
    -        assert(new File(defaultTablePath).exists())
    -
    -        sql("INSERT INTO tbl SELECT 2")
    -        checkAnswer(spark.table("tbl"), Row(2))
    -        // newly inserted data will go to the new table path.
    -        assert(dir.listFiles().nonEmpty)
    -
    -        sql("DROP TABLE tbl")
    -        // the new table path will be removed after DROP TABLE.
    -        assert(!dir.exists())
    +        try {
    +          sql(s"ALTER TABLE tbl SET LOCATION '${dir.toURI}'")
    +          spark.catalog.refreshTable("tbl")
    +          // SET LOCATION won't move data from previous table path to new 
table path.
    +          assert(spark.table("tbl").count() == 0)
    +          // the previous table path should be still there.
    +          assert(new File(defaultTablePath).exists())
    +
    +          sql("INSERT INTO tbl SELECT 2")
    +          checkAnswer(spark.table("tbl"), Row(2))
    +          // newly inserted data will go to the new table path.
    +          assert(dir.listFiles().nonEmpty)
    +
    +          sql("DROP TABLE tbl")
    +          // the new table path will be removed after DROP TABLE.
    +          assert(!dir.exists())
    +        } finally {
    +          Utils.deleteRecursively(new File(defaultTablePath))
    --- End diff --
    
    We need to explicitly drop the original table location. 


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