You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@seatunnel.apache.org by "ponyliuh (via GitHub)" <gi...@apache.org> on 2023/09/14 01:47:41 UTC

[GitHub] [seatunnel] ponyliuh commented on a diff in pull request #5427: [fix][hive-source][bug] fix An error occurred reading an empty directory

ponyliuh commented on code in PR #5427:
URL: https://github.com/apache/seatunnel/pull/5427#discussion_r1325249125


##########
seatunnel-connectors-v2/connector-file/connector-file-base/src/main/java/org/apache/seatunnel/connectors/seatunnel/file/source/reader/AbstractReadStrategy.java:
##########
@@ -153,15 +151,10 @@ public List<String> getFileNamesByPath(HadoopConf hadoopConf, String path) throw
                 }
             }
         }
-
-        if (fileNames.isEmpty()) {
-            throw new FileConnectorException(
-                    FileConnectorErrorCode.FILE_LIST_EMPTY,
-                    "The target file list is empty,"
-                            + "SeaTunnel will not be able to sync empty table, "
-                            + "please check the configuration parameters such as: [file_filter_pattern]");
+        if (this.fileNames.isEmpty()) {
+            log.error("The current directory is empty " + path);
+            this.fileNames.add(path);

Review Comment:
   为啥还把文件夹的名称加进去,fileNames里面装的是可阅读的文件的名称,只要保证这个方法返回的集合里的文件不为空,如若为空则抛出异常就可以。



##########
seatunnel-connectors-v2/connector-file/connector-file-base/src/main/java/org/apache/seatunnel/connectors/seatunnel/file/source/reader/AbstractReadStrategy.java:
##########
@@ -153,15 +151,10 @@ public List<String> getFileNamesByPath(HadoopConf hadoopConf, String path) throw
                 }
             }
         }
-
-        if (fileNames.isEmpty()) {
-            throw new FileConnectorException(
-                    FileConnectorErrorCode.FILE_LIST_EMPTY,
-                    "The target file list is empty,"
-                            + "SeaTunnel will not be able to sync empty table, "
-                            + "please check the configuration parameters such as: [file_filter_pattern]");
+        if (this.fileNames.isEmpty()) {
+            log.error("The current directory is empty " + path);
+            this.fileNames.add(path);

Review Comment:
   为啥还把文件夹的名称加进去,fileNames里面装的是可阅读的文件的名称,只要保证这个方法返回的集合里的文件不为空,如若为空则抛出异常就可以。



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

To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org