You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by GitBox <gi...@apache.org> on 2020/11/07 14:34:37 UTC

[GitHub] [incubator-doris] morningman commented on a change in pull request #4810: [Broker Load] Ignore empty file when file format is parquet or orc.

morningman commented on a change in pull request #4810:
URL: https://github.com/apache/incubator-doris/pull/4810#discussion_r519183401



##########
File path: fe/fe-core/src/main/java/org/apache/doris/load/loadv2/BrokerLoadPendingTask.java
##########
@@ -77,18 +77,32 @@ private void getAllFileStatus() throws UserException {
                 for (String path : fileGroup.getFilePaths()) {
                     BrokerUtil.parseFile(path, brokerDesc, fileStatuses);
                 }
-                fileStatusList.add(fileStatuses);
+                boolean isBinaryFileFormat = fileGroup.isBinaryFileFormat();
+                int fileNum = 0;
+                List<TBrokerFileStatus> filteredFileStatuses = Lists.newArrayList();
                 for (TBrokerFileStatus fstatus : fileStatuses) {
-                    groupFileSize += fstatus.getSize();
-                    if (LOG.isDebugEnabled()) {
-                        LOG.debug(new LogBuilder(LogKey.LOAD_JOB, callback.getCallbackId())
-                                .add("file_status", fstatus).build());
+                    if (fstatus.getSize() == 0 && isBinaryFileFormat) {
+                        // For parquet or orc file, if it is an empty file, ignore it.
+                        // Because we can not read an empty parquet or orc file.
+                        if (LOG.isDebugEnabled()) {
+                            LOG.debug(new LogBuilder(LogKey.LOAD_JOB, callback.getCallbackId())
+                                    .add("empty file", fstatus).build());
+                        }
+                    } else {
+                        groupFileSize += fstatus.size;
+                        fileNum++;
+                        filteredFileStatuses.add(fstatus);
+                        if (LOG.isDebugEnabled()) {
+                            LOG.debug(new LogBuilder(LogKey.LOAD_JOB, callback.getCallbackId())
+                                    .add("file_status", fstatus).build());
+                        }
                     }
                 }
+                fileStatusList.add(filteredFileStatuses);
                 tableTotalFileSize += groupFileSize;
-                tableTotalFileNum += fileStatuses.size();
+                tableTotalFileNum += fileNum;

Review comment:
       Removed




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



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org