[SPARK-31163][SQL] TruncateTableCommand with acl/permission should handle non-existent path#27923
Closed
Ngone51 wants to merge 1 commit intoapache:masterfrom
Closed
[SPARK-31163][SQL] TruncateTableCommand with acl/permission should handle non-existent path#27923Ngone51 wants to merge 1 commit intoapache:masterfrom
Ngone51 wants to merge 1 commit intoapache:masterfrom
Conversation
Member
Author
|
Test build #119836 has finished for PR 27923 at commit
|
cloud-fan
reviewed
Mar 16, 2020
| assert(!path.exists()) | ||
| // execute without java.io.FileNotFoundException | ||
| sql("TRUNCATE TABLE tab1") | ||
| // partition path should be re-created |
Contributor
There was a problem hiding this comment.
this only affects partition path, or table path as well?
Member
Author
There was a problem hiding this comment.
Both, but can be more likely to happen on partition path since there's much more than table path.
Contributor
|
retest this please |
cloud-fan
approved these changes
Mar 16, 2020
HyukjinKwon
approved these changes
Mar 16, 2020
|
Test build #119849 has finished for PR 27923 at commit
|
dongjoon-hyun
approved these changes
Mar 16, 2020
Member
dongjoon-hyun
left a comment
There was a problem hiding this comment.
+1, LGTM. Thank you, @Ngone51 , @cloud-fan , @viirya , @HyukjinKwon .
Merged to master/3.0/2.4.
dongjoon-hyun
pushed a commit
that referenced
this pull request
Mar 16, 2020
…ndle non-existed path ### What changes were proposed in this pull request? This fix #26956 Wrap try-catch on `fs.getFileStatus(path)` within acl/permission in case of the path doesn't exist. ### Why are the changes needed? `truncate table` may fail to re-create path in case of interruption or something else. As a result, next time we `truncate table` on the same table with acl/permission, it will fail due to `FileNotFoundException`. And it also brings behavior change compares to previous Spark version, which could still `truncate table` successfully even if the path doesn't exist. ### Does this PR introduce any user-facing change? No. ### How was this patch tested? Added UT. Closes #27923 from Ngone51/fix_truncate. Authored-by: yi.wu <yi.wu@databricks.com> Signed-off-by: Dongjoon Hyun <dongjoon@apache.org> (cherry picked from commit cb26f63) Signed-off-by: Dongjoon Hyun <dongjoon@apache.org>
dongjoon-hyun
pushed a commit
that referenced
this pull request
Mar 16, 2020
…ndle non-existed path ### What changes were proposed in this pull request? This fix #26956 Wrap try-catch on `fs.getFileStatus(path)` within acl/permission in case of the path doesn't exist. ### Why are the changes needed? `truncate table` may fail to re-create path in case of interruption or something else. As a result, next time we `truncate table` on the same table with acl/permission, it will fail due to `FileNotFoundException`. And it also brings behavior change compares to previous Spark version, which could still `truncate table` successfully even if the path doesn't exist. ### Does this PR introduce any user-facing change? No. ### How was this patch tested? Added UT. Closes #27923 from Ngone51/fix_truncate. Authored-by: yi.wu <yi.wu@databricks.com> Signed-off-by: Dongjoon Hyun <dongjoon@apache.org> (cherry picked from commit cb26f63) Signed-off-by: Dongjoon Hyun <dongjoon@apache.org>
Member
Author
|
thanks all! |
sjincho
pushed a commit
to sjincho/spark
that referenced
this pull request
Apr 15, 2020
…ndle non-existed path ### What changes were proposed in this pull request? This fix apache#26956 Wrap try-catch on `fs.getFileStatus(path)` within acl/permission in case of the path doesn't exist. ### Why are the changes needed? `truncate table` may fail to re-create path in case of interruption or something else. As a result, next time we `truncate table` on the same table with acl/permission, it will fail due to `FileNotFoundException`. And it also brings behavior change compares to previous Spark version, which could still `truncate table` successfully even if the path doesn't exist. ### Does this PR introduce any user-facing change? No. ### How was this patch tested? Added UT. Closes apache#27923 from Ngone51/fix_truncate. Authored-by: yi.wu <yi.wu@databricks.com> Signed-off-by: Dongjoon Hyun <dongjoon@apache.org>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changes were proposed in this pull request?
This fix #26956
Wrap try-catch on
fs.getFileStatus(path)within acl/permission in case of the path doesn't exist.Why are the changes needed?
truncate tablemay fail to re-create path in case of interruption or something else. As a result, next time wetruncate tableon the same table with acl/permission, it will fail due toFileNotFoundException. And it also brings behavior change compares to previous Spark version, which could stilltruncate tablesuccessfully even if the path doesn't exist.Does this PR introduce any user-facing change?
No.
How was this patch tested?
Added UT.