xubo245 commented on a change in pull request #3886:
URL: https://github.com/apache/carbondata/pull/3886#discussion_r468283782



##########
File path: 
integration/spark/src/main/scala/org/apache/spark/sql/execution/command/management/CarbonInsertFromStageCommand.scala
##########
@@ -557,25 +564,30 @@ case class CarbonInsertFromStageCommand(
    * Return the files failed to delete
    */
   private def deleteStageFiles(
+      stagePath: String,
       executorService: ExecutorService,
       stageFiles: Array[(CarbonFile, CarbonFile)]): Array[(CarbonFile, 
CarbonFile)] = {
     stageFiles.map { files =>
       executorService.submit(new Callable[(CarbonFile, CarbonFile, Boolean)] {
         override def call(): (CarbonFile, CarbonFile, Boolean) = {
           // Delete three types of file: stage|.success|.loading
-          val stageLoadingFile =
-            FileFactory.getCarbonFile(files._1.getAbsolutePath
-              + CarbonTablePath.LOADING_FILE_SUFFIX);
-          var isFailed = false
-          // If delete() return false, maybe the reason is FileNotFount or 
FileFailedClean.
-          // Considering FileNotFound means file clean successfully.
-          // We need double check the file exists or not when delete() return 
false.
-          if (!(files._1.delete() && files._2.delete() && 
stageLoadingFile.delete())) {
-            // If the file still exists,  make isFailed to be true
-            // So we can retry to delete this file.
-            isFailed = files._1.exists() || files._1.exists() || 
stageLoadingFile.exists()
+          try {
+            val stageLoadingFile = FileFactory.getCarbonFile(stagePath +
+              CarbonCommonConstants.FILE_SEPARATOR +
+              files._1.getName + CarbonTablePath.LOADING_FILE_SUFFIX);
+            var isFailed = false
+            // If delete() return false, maybe the reason is FileNotFount or 
FileFailedClean.
+            // Considering FileNotFound means FileCleanSucessfully.
+            // We need double check the file exists or not when delete() 
return false.
+            if (!files._1.delete() || !files._2.delete() || 
!stageLoadingFile.delete()) {
+              // If the file still exists,  make isFailed to be true
+              // So we can retry to delete this file.
+              isFailed = files._1.exists() || files._1.exists() || 
stageLoadingFile.exists()
+            }
+            (files._1, files._2, isFailed)
+          } catch {
+            case _: Exception => (files._1, files._2, true)

Review comment:
       Why return (files._1, files._2, true) when exception happen?




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

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to