You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@carbondata.apache.org by GitBox <gi...@apache.org> on 2019/08/08 06:29:35 UTC

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

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_r311873103
 
 

 ##########
 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));
 
 Review comment:
   ```suggestion
             FileFactory.getCarbonFile(carbonFilePath);
   ```
   and move to previous line

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services