LiJie20190102 commented on code in PR #10049:
URL: https://github.com/apache/seatunnel/pull/10049#discussion_r2512798667
##########
seatunnel-connectors-v2/connector-file/connector-file-base/src/main/java/org/apache/seatunnel/connectors/seatunnel/file/source/reader/AbstractReadStrategy.java:
##########
@@ -405,9 +407,14 @@ protected SeaTunnelRowType mergePartitionTypes(String
path, SeaTunnelRowType sea
return new SeaTunnelRowType(newFieldNames, newFieldTypes);
}
- protected boolean filterFileByPattern(FileStatus fileStatus) {
+ protected boolean filterFileByPattern(String path, FileStatus fileStatus) {
if (Objects.nonNull(pattern)) {
- return pattern.matcher(fileStatus.getPath().getName()).matches();
+ if (pattern.pattern().startsWith(path)) {
+ // filter based on the file directory at the same time
+ return
pattern.matcher(fileStatus.getPath().getName()).matches();
+ }
+ // filter based on file names
+ return
pattern.matcher(fileStatus.getPath().toUri().getPath()).matches();
Review Comment:
Thank you for your review. I have made improvements and the fileStatus in
this method will only be files, not directories
--
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]