LiJie20190102 commented on code in PR #10049:
URL: https://github.com/apache/seatunnel/pull/10049#discussion_r2583326701


##########
seatunnel-connectors-v2/connector-file/connector-file-base/src/main/java/org/apache/seatunnel/connectors/seatunnel/file/source/reader/AbstractReadStrategy.java:
##########
@@ -406,7 +412,15 @@ protected SeaTunnelRowType mergePartitionTypes(String 
path, SeaTunnelRowType sea
     }
 
     protected boolean filterFileByPattern(FileStatus fileStatus) {
-        if (Objects.nonNull(pattern)) {
+        if (Objects.nonNull(pattern) && Objects.nonNull(fileBasePath)) {
+            if (pattern.pattern().startsWith(fileBasePath)) {
+                // filter based on the file directory at the same time
+                String absPath = fileStatus.getPath().toUri().getPath();
+                // absPath.substring(absPath.indexOf(fileBasePath), It is to 
be compatible with
+                // scenarios where fileBasePath is a relative path
+                return 
pattern.matcher(absPath.substring(absPath.indexOf(fileBasePath))).matches();

Review Comment:
   We will definitely find this substring here because absPath is the file 
path, and the file is found by fileBasePath



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

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to