QiangCai commented on a change in pull request #3842:
URL: https://github.com/apache/carbondata/pull/3842#discussion_r456206506



##########
File path: 
integration/spark/src/main/scala/org/apache/spark/rdd/CarbonMergeFilesRDD.scala
##########
@@ -157,21 +157,21 @@ object CarbonMergeFilesRDD {
     if (carbonTable.isHivePartitionTable && 
!StringUtils.isEmpty(tempFolderPath)) {
       // remove all tmp folder of index files
       val startDelete = System.currentTimeMillis()
-      val numThreads = Math.min(Math.max(partitionInfo.size(), 1), 10)
-      val executorService = Executors.newFixedThreadPool(numThreads)
-      val carbonSessionInfo = ThreadLocalSessionInfo.getCarbonSessionInfo
-      partitionInfo
-        .asScala
-        .map { partitionPath =>
-          executorService.submit(new Runnable {
-            override def run(): Unit = {
-              ThreadLocalSessionInfo.setCarbonSessionInfo(carbonSessionInfo)
-              FileFactory.deleteAllCarbonFilesOfDir(
-                FileFactory.getCarbonFile(partitionPath + "/" + 
tempFolderPath))
-            }
-          })
+      val allTmpDirs = partitionInfo
+        .asScala.map { partitionPath =>
+          partitionPath + CarbonCommonConstants.FILE_SEPARATOR + tempFolderPath
         }
-        .map(_.get())
+      val allTmpFiles = allTmpDirs.map { partitionDir =>
+          FileFactory.getCarbonFile(partitionDir).listFiles()

Review comment:
       if loading create too many partitions, this listFiles will take a long 
time also.




----------------------------------------------------------------
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:
[email protected]


Reply via email to