zhangbutao commented on code in PR #5090:
URL: https://github.com/apache/hive/pull/5090#discussion_r1494668292
##########
ql/src/java/org/apache/hadoop/hive/ql/session/ClearDanglingScratchDir.java:
##########
@@ -252,17 +252,12 @@ static Options createOptions() {
*/
private void removeLocalTmpFiles(String sessionName, String localTmpdir) {
File[] files = new File(localTmpdir).listFiles(fn ->
fn.getName().startsWith(sessionName));
- boolean success;
if (files != null) {
for (File file : files) {
- success = false;
- if (file.canWrite()) {
- success = file.delete();
- }
- if (success) {
+ if (file.canWrite() && file.delete()) {
consoleMessage("While removing '" + sessionName + "' dangling
scratch dir from HDFS, "
+ "local tmp session file '" + file.getPath() + "' has been
cleaned as well.");
- } else if (file.getName().startsWith(sessionName)) {
Review Comment:
See Line 254, file in here is already` startsWith(sessionName)`, so no need
check this again.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]