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

    https://github.com/apache/spark/pull/15024#discussion_r78471404
  
    --- Diff: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/catalog/InMemoryCatalog.scala
 ---
    @@ -253,6 +266,7 @@ class InMemoryCatalog(
               throw new SparkException(s"Unable to rename table $oldName to 
$newName as failed " +
                 s"to rename its directory $oldDir", e)
           }
    +      oldDesc.table = oldDesc.table.withNewStorage(locationUri = 
Some(newDir.toUri.toString))
    --- End diff --
    
    In Hive, users are allowed to create a Hive managed table with the 
user-specified location. In Spark SQL, we do not allow users to do it. If users 
specify the location, we always convert the type to EXTERNAL.
    
    When we creating managed table without a location, Hive will set it for us. 
Before this PR, sometimes we check `path` and sometimes we check `locationUri`. 
It could hide bugs we do not realize, especially for 
`CreateDataSourceTableAsSelectCommand`. We assume our generated `path` is 
always identical to the `locationUri` that is populated by Hive. Thus, we 
should explicitly set `locationUri` for Hive managed table using our generated 
`path`.
    
    Based on my understanding, here is to ensure `InMemoryCatalog` and 
`HiveExternalCatalog` behave the same. 
    



---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to