davidzollo commented on PR #10014:
URL: https://github.com/apache/seatunnel/pull/10014#issuecomment-3490936672
Thank you for your contribution.
The following tasks need to be done before merged:
1. Modify the code to maintain backward compatibility:
- Support both path matching and filename matching
- Add detailed code comments to explain the behavior
2. Add the related test cases
3. Please update the documentation and the configuration description of
`FILE_FILTER_PATTERN`
Here is an example code you can refer to.
```
protected boolean filterFileByPattern(FileStatus fileStatus) {
if (Objects.nonNull(pattern)) {
String fullPath = fileStatus.getPath().toUri().getPath();
String fileName = fileStatus.getPath().getName();
// Match against both full path and file name for maximum
compatibility
// This allows users to use either path-based patterns (e.g.,
"/path/to/dir/.*.json")
// or name-based patterns (e.g., "e2e_filter.*")
boolean matches = pattern.matcher(fullPath).matches() ||
pattern.matcher(fileName).matches();
if (log.isDebugEnabled()) {
log.debug("Filtering file: fullPath={}, fileName={}, pattern={},
matches={}",
fullPath, fileName, pattern.pattern(), matches);
}
return matches;
}
return true;
}
```
--
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]