GitHub user gatorsmile opened a pull request:

    https://github.com/apache/spark/pull/16728

    [SPARK-19359][SQL] Revert Clear useless path after rename a partition with 
upper-case by HiveExternalCatalog

    ### What changes were proposed in this pull request?
    
    This PR is to revert the changes made in 
https://github.com/apache/spark/pull/16700. It could cause the data loss after 
partition rename, because we have a bug in the file rename. 
    
    Not all the file systems have the same behaviors. For example, on mac OS, 
if we renaming a path from `.../tbl/a=5/b=6` to `.../tbl/A=5/B=6`. The result 
is `.../tbl/a=5/B=6`. Thus, renaming is not recursive. However, the file system 
used in Jenkin does not have such an issue. Although this PR is not the root 
cause, it exposes an existing issue on the code 
`tablePath.getFileSystem(hadoopConf).rename(wrongPath, rightPath)`
    
    --- 
    
    Hive metastore is not case preserving and keep partition columns with lower 
case names.
    
    If SparkSQL create a table with upper-case partion name use 
HiveExternalCatalog, when we rename partition, it first call the HiveClient to 
renamePartition, which will create a new lower case partition path, then 
SparkSql rename the lower case path to the upper-case.
    
    while if the renamed partition contains more than one depth partition ,e.g. 
A=1/B=2, hive renamePartition change to a=1/b=2, then SparkSql rename it to 
A=1/B=2, but the a=1 still exists in the filesystem, we should also delete it.
    
    ### How was this patch tested?
    N/A

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/gatorsmile/spark revert-pr-16700

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/spark/pull/16728.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #16728
    
----
commit a398036ec957e8d9d67f038095408f576a13c982
Author: gatorsmile <[email protected]>
Date:   2017-01-28T19:22:26Z

    revert

----


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