[GitHub] [carbondata] jackylk commented on a change in pull request #3350: [CARBONDATA-3488] Check the file size after move local file to carbon path

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[GitHub] [carbondata] jackylk commented on a change in pull request #3350: [CARBONDATA-3488] Check the file size after move local file to carbon path

GitBox
jackylk commented on a change in pull request #3350: [CARBONDATA-3488] Check the file size after move local file to carbon path
URL: https://github.com/apache/carbondata/pull/3350#discussion_r311873317
 
 

 ##########
 File path: core/src/main/java/org/apache/carbondata/core/util/CarbonUtil.java
 ##########
 @@ -2741,12 +2741,28 @@ public static void copyCarbonDataFileToCarbonStorePath(String localFilePath,
     try {
       CarbonFile localCarbonFile =
           FileFactory.getCarbonFile(localFilePath, FileFactory.getFileType(localFilePath));
+      if (localCarbonFile.getSize() == 0L) {
+        LOGGER.error("The file size of local carbon file: " + localFilePath + " is 0.");
+        throw new CarbonDataWriterException(
+            "The file size of local carbon file is 0.");
+      }
       String carbonFilePath = carbonDataDirectoryPath + localFilePath
           .substring(localFilePath.lastIndexOf(File.separator));
       copyLocalFileToCarbonStore(carbonFilePath, localFilePath,
           CarbonCommonConstants.BYTEBUFFER_SIZE,
           getMaxOfBlockAndFileSize(fileSizeInBytes, localCarbonFile.getSize()));
-    } catch (IOException e) {
+      CarbonFile targetCarbonFile =
+          FileFactory.getCarbonFile(carbonFilePath, FileFactory.getFileType(carbonFilePath));
+      if (targetCarbonFile.getSize() == 0L
 
 Review comment:
   please add comment to explain this check before this statement

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


With regards,
Apache Git Services