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



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

Review comment:
       Suggestion:  use  File.separator  instead of   
CarbonCommonConstants.FILE_SEPARATOR,  File.separator  can  support  linux and 
window。




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