You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@seatunnel.apache.org by "MyeoungDev (via GitHub)" <gi...@apache.org> on 2026/02/22 08:58:05 UTC
[PR] [Feature][Connector-V2] Add recursive_file_scan option for file connectors [seatunnel]
MyeoungDev opened a new pull request, #10505:
URL: https://github.com/apache/seatunnel/pull/10505
<!--
Thank you for contributing to SeaTunnel! Please make sure that your code changes
are covered with tests. And in case of new features or big changes
remember to adjust the documentation.
Feel free to ping committers for the review!
## Contribution Checklist
- Make sure that the pull request corresponds to a [GITHUB issue](https://github.com/apache/seatunnel/issues).
- Name the pull request in the form "[Feature] [component] Title of the pull request", where *Feature* can be replaced by `Hotfix`, `Bug`, etc.
- Minor fixes should be named following this pattern: `[hotfix] [docs] Fix typo in README.md doc`.
-->
### Purpose of this pull request
Closed #10504
<!-- Describe the purpose of this pull request. For example: This pull request adds checkstyle plugin.-->
### Does this PR introduce _any_ user-facing change?
<!--
Note that it means *any* user-facing change including all aspects such as the documentation fix.
If yes, please clarify the previous behavior and the change this PR proposes - provide the console output, description and/or an example to show the behavior difference if possible.
If possible, please also clarify if this is a user-facing change compared to the released SeaTunnel versions or within the unreleased branches such as dev.
If no, write 'No'.
If you are adding/modifying connector documents, please follow our new specifications: https://github.com/apache/seatunnel/issues/4544.
-->
### How was this patch tested?
<!--
If tests were added, say they were added here. Please make sure to add some test cases that check the changes thoroughly including negative and positive cases if possible.
If it was tested in a way different from regular unit tests, please clarify how you tested step by step, ideally copy and paste-able, so that other reviewers can test and check, and descendants can verify in the future.
If tests were not added, please describe why they were not added and/or why it was difficult to add.
If you are adding E2E test cases, maybe refer to https://github.com/apache/seatunnel/blob/dev/seatunnel-e2e/seatunnel-connector-v2-e2e/connector-cdc-mysql-e2e/src/test/resources/mysqlcdc_to_mysql.conf, here is a good example.
-->
### Check list
* [ ] If any new Jar binary package adding in your PR, please add License Notice according
[New License Guide](https://github.com/apache/seatunnel/blob/dev/docs/en/contribution/new-license.md)
* [ ] If necessary, please update the documentation to describe the new feature. https://github.com/apache/seatunnel/tree/dev/docs
* [ ] If necessary, please update `incompatible-changes.md` to describe the incompatibility caused by this PR.
* [ ] If you are contributing the connector code, please check that the following files are updated:
1. Update [plugin-mapping.properties](https://github.com/apache/seatunnel/blob/dev/plugin-mapping.properties) and add new connector information in it
2. Update the pom file of [seatunnel-dist](https://github.com/apache/seatunnel/blob/dev/seatunnel-dist/pom.xml)
3. Add ci label in [label-scope-conf](https://github.com/apache/seatunnel/blob/dev/.github/workflows/labeler/label-scope-conf.yml)
4. Add e2e testcase in [seatunnel-e2e](https://github.com/apache/seatunnel/tree/dev/seatunnel-e2e/seatunnel-connector-v2-e2e/)
5. Update connector [plugin_config](https://github.com/apache/seatunnel/blob/dev/config/plugin_config)
--
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
Re: [PR] [Feature][Connector-V2] Add recursive_file_scan option for file connectors [seatunnel]
Posted by "MyeoungDev (via GitHub)" <gi...@apache.org>.
MyeoungDev commented on PR #10505:
URL: https://github.com/apache/seatunnel/pull/10505#issuecomment-4107264342
Hi @corgy-w @zhangshenghang
Could you please take a look at this PR when you have a chance?
--
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
Re: [PR] [Feature][Connector-V2] Add recursive_file_scan option for file connectors [seatunnel]
Posted by "MyeoungDev (via GitHub)" <gi...@apache.org>.
MyeoungDev commented on PR #10505:
URL: https://github.com/apache/seatunnel/pull/10505#issuecomment-3976037155
@yzeng1618 Thanks for the feedback.
I'll use the LocalFile connector to verify the `recursive_file_scan` option by creating a multi-level directory structure and checking the row count in the E2E module.
I will let you know once I've pushed the updates.
--
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
Re: [PR] [Feature][Connector-V2] Add recursive_file_scan option for file connectors [seatunnel]
Posted by "MyeoungDev (via GitHub)" <gi...@apache.org>.
MyeoungDev commented on code in PR #10505:
URL: https://github.com/apache/seatunnel/pull/10505#discussion_r2944808340
##########
docs/en/connectors/source/HdfsFile.md:
##########
@@ -80,19 +80,20 @@ Read data from hdfs file system.
| null_format | string | no | - | Only used when file_format_type is text. null_format to define which strings can be represented as null. e.g: `\N` |
| binary_chunk_size | int | no | 1024 | Only used when file_format_type is binary. The chunk size (in bytes) for reading binary files. Default is 1024 bytes. Larger values may improve performance for large files but use more memory. |
| binary_complete_file_mode | boolean | no | false | Only used when file_format_type is binary. Whether to read the complete file as a single chunk instead of splitting into chunks. When enabled, the entire file content will be read into memory at once. Default is false. |
-| sync_mode | string | no | full | File sync mode. Supported values: `full`, `update`. When `update`, the source compares files between source/target and only reads new/changed files (currently only supports `file_format_type=binary`). |
+| sync_mode | string | no | full | File sync mode. Supported values: `full`, `update`. When `update`, the source compares files between source/target and only reads new/changed files (currently only supports `file_format_type=binary`). |
Review Comment:
Thanks for confirming and for the feedback!
I'll proceed with extending the same test scenarios to the other connectors (HDFS / FTP / SFTP) that support sync_mode=update.
--
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
Re: [PR] [Feature][Connector-V2] Add recursive_file_scan option for file connectors [seatunnel]
Posted by "yzeng1618 (via GitHub)" <gi...@apache.org>.
yzeng1618 commented on code in PR #10505:
URL: https://github.com/apache/seatunnel/pull/10505#discussion_r2938707890
##########
docs/en/connectors/source/HdfsFile.md:
##########
@@ -80,19 +80,20 @@ Read data from hdfs file system.
| null_format | string | no | - | Only used when file_format_type is text. null_format to define which strings can be represented as null. e.g: `\N` |
| binary_chunk_size | int | no | 1024 | Only used when file_format_type is binary. The chunk size (in bytes) for reading binary files. Default is 1024 bytes. Larger values may improve performance for large files but use more memory. |
| binary_complete_file_mode | boolean | no | false | Only used when file_format_type is binary. Whether to read the complete file as a single chunk instead of splitting into chunks. When enabled, the entire file content will be read into memory at once. Default is false. |
-| sync_mode | string | no | full | File sync mode. Supported values: `full`, `update`. When `update`, the source compares files between source/target and only reads new/changed files (currently only supports `file_format_type=binary`). |
+| sync_mode | string | no | full | File sync mode. Supported values: `full`, `update`. When `update`, the source compares files between source/target and only reads new/changed files (currently only supports `file_format_type=binary`). |
Review Comment:
> The HdfsFile connector supports sync_mode=update, which works by comparing file differences between the source and target and reading only newly added or modified files. When recursive_file_scan=false is used together with sync_mode=update, does the non-recursive file discovery scope also apply to the comparison logic for the target path? This combination scenario needs to be taken into account.
>
> Currently, the connectors that support the sync_mode=update parameter are FTP/SFTP/HDFS/LocalFile. These need to be added together.
Please also take this situation into consideration.
--
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
Re: [PR] [Feature][Connector-V2] Add recursive_file_scan option for file connectors [seatunnel]
Posted by "MyeoungDev (via GitHub)" <gi...@apache.org>.
MyeoungDev commented on PR #10505:
URL: https://github.com/apache/seatunnel/pull/10505#issuecomment-4628464401
Hi, @davidzollo @yzeng1618 @corgy-w
Sorry for the delay in updating this PR.
I resolved the conflicts with the latest dev branch.
I also added the `recursive_file_scan` behavior in continuous discovery mode and added unit tests and E2E tests for it.
CI is green now. Please take another look when you have time.
--
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
Re: [PR] [Feature][Connector-V2] Add recursive_file_scan option for file connectors [seatunnel]
Posted by "DanielLeens (via GitHub)" <gi...@apache.org>.
DanielLeens commented on PR #10505:
URL: https://github.com/apache/seatunnel/pull/10505#issuecomment-4630622179
Thanks @yzeng1618 for taking another look and confirming the latest head.
There is still no code change after Daniel's latest review, so I am treating this as a reply-only follow-up rather than starting another full re-review on the same commit.
From Daniel's side I do not have any new blocker on `11141d87852477ed82db7d96c42831fb6b1ed6a9`. The remaining thing to watch is the PR check status on GitHub. Once the current Build finishes green, I do not have anything else to add here.
--
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
Re: [PR] [Feature][Connector-V2] Add recursive_file_scan option for file connectors [seatunnel]
Posted by "MyeoungDev (via GitHub)" <gi...@apache.org>.
MyeoungDev commented on PR #10505:
URL: https://github.com/apache/seatunnel/pull/10505#issuecomment-4024126006
Hi @yzeng1618 ,
Thank you for your review.
All comments have been addressed and the PR has been updated.
Could you please help review it again when you have time?
Thanks a lot!
--
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
Re: [PR] [Feature][Connector-V2] Add recursive_file_scan option for file connectors [seatunnel]
Posted by "yzeng1618 (via GitHub)" <gi...@apache.org>.
yzeng1618 commented on code in PR #10505:
URL: https://github.com/apache/seatunnel/pull/10505#discussion_r2908815415
##########
docs/en/connectors/source/HdfsFile.md:
##########
@@ -80,19 +80,20 @@ Read data from hdfs file system.
| null_format | string | no | - | Only used when file_format_type is text. null_format to define which strings can be represented as null. e.g: `\N` |
| binary_chunk_size | int | no | 1024 | Only used when file_format_type is binary. The chunk size (in bytes) for reading binary files. Default is 1024 bytes. Larger values may improve performance for large files but use more memory. |
| binary_complete_file_mode | boolean | no | false | Only used when file_format_type is binary. Whether to read the complete file as a single chunk instead of splitting into chunks. When enabled, the entire file content will be read into memory at once. Default is false. |
-| sync_mode | string | no | full | File sync mode. Supported values: `full`, `update`. When `update`, the source compares files between source/target and only reads new/changed files (currently only supports `file_format_type=binary`). |
+| sync_mode | string | no | full | File sync mode. Supported values: `full`, `update`. When `update`, the source compares files between source/target and only reads new/changed files (currently only supports `file_format_type=binary`). |
| target_path | string | no | - | Only used when `sync_mode=update`. Target base path used for comparison (it should usually be the same as sink `path`). |
-| target_hadoop_conf | map | no | - | Only used when `sync_mode=update`. Extra Hadoop configuration for target filesystem. You can set `fs.defaultFS` in this map to override target defaultFS. |
-| update_strategy | string | no | distcp | Only used when `sync_mode=update`. Supported values: `distcp` (default), `strict`. |
-| compare_mode | string | no | len_mtime | Only used when `sync_mode=update`. Supported values: `len_mtime` (default), `checksum` (only valid when `update_strategy=strict`). |
+| target_hadoop_conf | map | no | - | Only used when `sync_mode=update`. Extra Hadoop configuration for target filesystem. You can set `fs.defaultFS` in this map to override target defaultFS. |
+| update_strategy | string | no | distcp | Only used when `sync_mode=update`. Supported values: `distcp` (default), `strict`. |
+| compare_mode | string | no | len_mtime | Only used when `sync_mode=update`. Supported values: `len_mtime` (default), `checksum` (only valid when `update_strategy=strict`). |
Review Comment:
ditto
##########
docs/zh/connectors/source/HdfsFile.md:
##########
@@ -80,19 +80,20 @@ import ChangeLog from '../changelog/connector-file-hadoop.md';
| null_format | string | 否 | - | 仅在 file_format_type 为 text 时使用。null_format 定义哪些字符串可以表示为 null。例如:`\N` |
| binary_chunk_size | int | 否 | 1024 | 仅在 file_format_type 为 binary 时使用。读取二进制文件的块大小(以字节为单位)。默认为 1024 字节。较大的值可能会提高大文件的性能,但会使用更多内存。 |
| binary_complete_file_mode | boolean | 否 | false | 仅在 file_format_type 为 binary 时使用。是否将完整文件作为单个块读取,而不是分割成块。启用时,整个文件内容将一次性读入内存。默认为 false。 |
-| sync_mode | string | 否 | full | 文件同步模式,支持:`full`(默认)、`update`。当 `update` 时,对源/目标进行对比,只读取新增/变更文件(目前仅支持 `file_format_type=binary`)。 |
-| target_path | string | 否 | - | 仅在 `sync_mode=update` 时使用。目标端基础路径(通常应与 sink 的 `path` 一致),用于对比同相对路径文件。 |
-| target_hadoop_conf | map | 否 | - | 仅在 `sync_mode=update` 时使用。目标端 Hadoop 配置(可选),可在其中设置 `fs.defaultFS` 覆盖目标 defaultFS。 |
-| update_strategy | string | 否 | distcp | 仅在 `sync_mode=update` 时使用。支持:`distcp`(默认)、`strict`。 |
-| compare_mode | string | 否 | len_mtime | 仅在 `sync_mode=update` 时使用。支持:`len_mtime`(默认)、`checksum`(仅在 `update_strategy=strict` 时可用)。 |
+| sync_mode | string | 否 | full | 文件同步模式,支持:`full`(默认)、`update`。当 `update` 时,对源/目标进行对比,只读取新增/变更文件(目前仅支持 `file_format_type=binary`)。 |
+| target_path | string | 否 | - | 仅在 `sync_mode=update` 时使用。目标端基础路径(通常应与 sink 的 `path` 一致),用于对比同相对路径文件。 |
+| target_hadoop_conf | map | 否 | - | 仅在 `sync_mode=update` 时使用。目标端 Hadoop 配置(可选),可在其中设置 `fs.defaultFS` 覆盖目标 defaultFS。 |
+| update_strategy | string | 否 | distcp | 仅在 `sync_mode=update` 时使用。支持:`distcp`(默认)、`strict`。 |
+| compare_mode | string | 否 | len_mtime | 仅在 `sync_mode=update` 时使用。支持:`len_mtime`(默认)、`checksum`(仅在 `update_strategy=strict` 时可用)。 |
Review Comment:
ditto, Please fix similar cases together as well.
##########
docs/zh/connectors/source/HdfsFile.md:
##########
@@ -67,7 +67,7 @@ import ChangeLog from '../changelog/connector-file-hadoop.md';
| kerberos_principal | string | 否 | - | kerberos 的主体 |
| kerberos_keytab_path | string | 否 | - | kerberos 的 keytab 路径 |
| skip_header_row_number | long | 否 | 0 | 跳过前几行,但仅适用于 txt 和 csv。例如,设置如下:`skip_header_row_number = 2`。然后 Seatunnel 将跳过源文件的前 2 行 |
-| schema | config | 否 | - | 上游数据的 schema 字段。更多详情请参考 [Schema 特性](../../introduction/concepts/schema-feature.md)。 |
+| schema | config | 否 | - | 上游数据的 schema 字段。更多详情请参考 [Schema 特性](../../introduction/concepts/schema-feature.md)。 |
Review Comment:
ditto
##########
docs/en/connectors/source/HdfsFile.md:
##########
@@ -80,19 +80,20 @@ Read data from hdfs file system.
| null_format | string | no | - | Only used when file_format_type is text. null_format to define which strings can be represented as null. e.g: `\N` |
| binary_chunk_size | int | no | 1024 | Only used when file_format_type is binary. The chunk size (in bytes) for reading binary files. Default is 1024 bytes. Larger values may improve performance for large files but use more memory. |
| binary_complete_file_mode | boolean | no | false | Only used when file_format_type is binary. Whether to read the complete file as a single chunk instead of splitting into chunks. When enabled, the entire file content will be read into memory at once. Default is false. |
-| sync_mode | string | no | full | File sync mode. Supported values: `full`, `update`. When `update`, the source compares files between source/target and only reads new/changed files (currently only supports `file_format_type=binary`). |
+| sync_mode | string | no | full | File sync mode. Supported values: `full`, `update`. When `update`, the source compares files between source/target and only reads new/changed files (currently only supports `file_format_type=binary`). |
Review Comment:
The HdfsFile connector supports sync_mode=update, which works by comparing file differences between the source and target and reading only newly added or modified files. When recursive_file_scan=false is used together with sync_mode=update, does the non-recursive file discovery scope also apply to the comparison logic for the target path? This combination scenario needs to be taken into account.
Currently, the connectors that support the sync_mode=update parameter are FTP/SFTP/HDFS/LocalFile. These need to be added together.
##########
docs/en/connectors/source/HdfsFile.md:
##########
@@ -80,19 +80,20 @@ Read data from hdfs file system.
| null_format | string | no | - | Only used when file_format_type is text. null_format to define which strings can be represented as null. e.g: `\N` |
| binary_chunk_size | int | no | 1024 | Only used when file_format_type is binary. The chunk size (in bytes) for reading binary files. Default is 1024 bytes. Larger values may improve performance for large files but use more memory. |
| binary_complete_file_mode | boolean | no | false | Only used when file_format_type is binary. Whether to read the complete file as a single chunk instead of splitting into chunks. When enabled, the entire file content will be read into memory at once. Default is false. |
-| sync_mode | string | no | full | File sync mode. Supported values: `full`, `update`. When `update`, the source compares files between source/target and only reads new/changed files (currently only supports `file_format_type=binary`). |
+| sync_mode | string | no | full | File sync mode. Supported values: `full`, `update`. When `update`, the source compares files between source/target and only reads new/changed files (currently only supports `file_format_type=binary`). |
| target_path | string | no | - | Only used when `sync_mode=update`. Target base path used for comparison (it should usually be the same as sink `path`). |
-| target_hadoop_conf | map | no | - | Only used when `sync_mode=update`. Extra Hadoop configuration for target filesystem. You can set `fs.defaultFS` in this map to override target defaultFS. |
-| update_strategy | string | no | distcp | Only used when `sync_mode=update`. Supported values: `distcp` (default), `strict`. |
-| compare_mode | string | no | len_mtime | Only used when `sync_mode=update`. Supported values: `len_mtime` (default), `checksum` (only valid when `update_strategy=strict`). |
+| target_hadoop_conf | map | no | - | Only used when `sync_mode=update`. Extra Hadoop configuration for target filesystem. You can set `fs.defaultFS` in this map to override target defaultFS. |
+| update_strategy | string | no | distcp | Only used when `sync_mode=update`. Supported values: `distcp` (default), `strict`. |
+| compare_mode | string | no | len_mtime | Only used when `sync_mode=update`. Supported values: `len_mtime` (default), `checksum` (only valid when `update_strategy=strict`). |
| common-options | | no | - | Source plugin common parameters, please refer to [Source Common Options](../source-common-options.md) for details. |
| file_filter_modified_start | string | no | - | File modification time filter. The connector will filter some files base on the last modification start time (include start time). The default data format is `yyyy-MM-dd HH:mm:ss`. |
| file_filter_modified_end | string | no | - | File modification time filter. The connector will filter some files base on the last modification end time (not include end time). The default data format is `yyyy-MM-dd HH:mm:ss`. |
-| enable_file_split | boolean | no | false | Turn on logical file split to improve parallelism for huge files. Only supported for `text`/`csv`/`json`/`parquet` and non-compressed format. |
-| file_split_size | long | no | 134217728 | Split size in bytes when `enable_file_split=true`. For `text`/`csv`/`json`, the split end will be aligned to the next `row_delimiter`. For `parquet`, the split unit is RowGroup and will never break a RowGroup. |
+| enable_file_split | boolean | no | false | Turn on logical file split to improve parallelism for huge files. Only supported for `text`/`csv`/`json`/`parquet` and non-compressed format. |
+| file_split_size | long | no | 134217728 | Split size in bytes when `enable_file_split=true`. For `text`/`csv`/`json`, the split end will be aligned to the next `row_delimiter`. For `parquet`, the split unit is RowGroup and will never break a RowGroup. |
Review Comment:
ditto
##########
docs/en/connectors/source/HdfsFile.md:
##########
@@ -80,19 +80,20 @@ Read data from hdfs file system.
| null_format | string | no | - | Only used when file_format_type is text. null_format to define which strings can be represented as null. e.g: `\N` |
| binary_chunk_size | int | no | 1024 | Only used when file_format_type is binary. The chunk size (in bytes) for reading binary files. Default is 1024 bytes. Larger values may improve performance for large files but use more memory. |
| binary_complete_file_mode | boolean | no | false | Only used when file_format_type is binary. Whether to read the complete file as a single chunk instead of splitting into chunks. When enabled, the entire file content will be read into memory at once. Default is false. |
-| sync_mode | string | no | full | File sync mode. Supported values: `full`, `update`. When `update`, the source compares files between source/target and only reads new/changed files (currently only supports `file_format_type=binary`). |
+| sync_mode | string | no | full | File sync mode. Supported values: `full`, `update`. When `update`, the source compares files between source/target and only reads new/changed files (currently only supports `file_format_type=binary`). |
Review Comment:
This line has no content change, Please remove the trailing whitespace to keep the diff clean.
--
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
Re: [PR] [Feature][Connector-V2] Add recursive_file_scan option for file connectors [seatunnel]
Posted by "DanielLeens (via GitHub)" <gi...@apache.org>.
DanielLeens commented on PR #10505:
URL: https://github.com/apache/seatunnel/pull/10505#issuecomment-4189974561
I pulled this branch locally and I think there is still a real gap in the continuous discovery path.
The new option is only consumed inside `AbstractReadStrategy.collectFileNamesByPath()` / `setPluginConfig()` (`.../AbstractReadStrategy.java:168-178,339-341`).
But when `discovery_mode=continuous`, `BaseMultipleTableFileSource.createEnumerator()` switches to `ContinuousMultipleTableFileSourceSplitEnumerator` (`.../BaseMultipleTableFileSource.java:109-124`), and `TableScanContext.listFilesRecursively()` still descends into every directory unconditionally (`.../ContinuousMultipleTableFileSourceSplitEnumerator.java:591-599`).
So a job with `recursive_file_scan = false` plus `discovery_mode = continuous` will still scan nested directories, even though the docs now say subdirectories are ignored.
Could you either thread the option into the continuous enumerator and add a regression test there, or explicitly document that the flag only applies to one-time discovery?
--
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
Re: [PR] [Feature][Connector-V2] Add recursive_file_scan option for file connectors [seatunnel]
Posted by "yzeng1618 (via GitHub)" <gi...@apache.org>.
yzeng1618 merged PR #10505:
URL: https://github.com/apache/seatunnel/pull/10505
--
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
Re: [PR] [Feature][Connector-V2] Add recursive_file_scan option for file connectors [seatunnel]
Posted by "MyeoungDev (via GitHub)" <gi...@apache.org>.
MyeoungDev commented on code in PR #10505:
URL: https://github.com/apache/seatunnel/pull/10505#discussion_r2941471711
##########
docs/en/connectors/source/HdfsFile.md:
##########
@@ -80,19 +80,20 @@ Read data from hdfs file system.
| null_format | string | no | - | Only used when file_format_type is text. null_format to define which strings can be represented as null. e.g: `\N` |
| binary_chunk_size | int | no | 1024 | Only used when file_format_type is binary. The chunk size (in bytes) for reading binary files. Default is 1024 bytes. Larger values may improve performance for large files but use more memory. |
| binary_complete_file_mode | boolean | no | false | Only used when file_format_type is binary. Whether to read the complete file as a single chunk instead of splitting into chunks. When enabled, the entire file content will be read into memory at once. Default is false. |
-| sync_mode | string | no | full | File sync mode. Supported values: `full`, `update`. When `update`, the source compares files between source/target and only reads new/changed files (currently only supports `file_format_type=binary`). |
+| sync_mode | string | no | full | File sync mode. Supported values: `full`, `update`. When `update`, the source compares files between source/target and only reads new/changed files (currently only supports `file_format_type=binary`). |
Review Comment:
Hi @yzeng1618
Thanks for the review. I interpreted this combination scenario as
- `recursive_file_scan=false` should limit source file discovery to the top-level path only
- and in `sync_mode=update`, only the discovered source files should participate in target comparison/update decisions
Based on that, I first added
- unit tests in `UpdateSyncModeTest`
- local E2E coverage in `LocalFileIT`
Currently the added coverage includes
1. top-level and nested files both changed
- only the top-level file is considered when `recursive_file_scan=false`
2. nested-only changed
- no update happens when `recursive_file_scan=false`
3. local E2E for
- `distcp + recursive_file_scan=false`
- `strict checksum + recursive_file_scan=false`
Before I expand the same scenario to HDFS / FTP / SFTP, I want to confirm that this interpretation matches your expectation for `sync_mode=update` with non-recursive scan.
If this direction is correct, I’ll continue and add the same coverage for the other connectors that support `sync_mode=update`.
--
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
Re: [PR] [Feature][Connector-V2] Add recursive_file_scan option for file connectors [seatunnel]
Posted by "yzeng1618 (via GitHub)" <gi...@apache.org>.
yzeng1618 commented on code in PR #10505:
URL: https://github.com/apache/seatunnel/pull/10505#discussion_r2943887262
##########
docs/en/connectors/source/HdfsFile.md:
##########
@@ -80,19 +80,20 @@ Read data from hdfs file system.
| null_format | string | no | - | Only used when file_format_type is text. null_format to define which strings can be represented as null. e.g: `\N` |
| binary_chunk_size | int | no | 1024 | Only used when file_format_type is binary. The chunk size (in bytes) for reading binary files. Default is 1024 bytes. Larger values may improve performance for large files but use more memory. |
| binary_complete_file_mode | boolean | no | false | Only used when file_format_type is binary. Whether to read the complete file as a single chunk instead of splitting into chunks. When enabled, the entire file content will be read into memory at once. Default is false. |
-| sync_mode | string | no | full | File sync mode. Supported values: `full`, `update`. When `update`, the source compares files between source/target and only reads new/changed files (currently only supports `file_format_type=binary`). |
+| sync_mode | string | no | full | File sync mode. Supported values: `full`, `update`. When `update`, the source compares files between source/target and only reads new/changed files (currently only supports `file_format_type=binary`). |
Review Comment:
Your interpretation is correct. recursive_file_scan=false should limit source file discovery to the top-level path only, and sync_mode=update comparison should only operate on the discovered source files. The test coverage you've added for LocalFile looks solid.
--
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
Re: [PR] [Feature][Connector-V2] Add recursive_file_scan option for file connectors [seatunnel]
Posted by "MyeoungDev (via GitHub)" <gi...@apache.org>.
MyeoungDev commented on PR #10505:
URL: https://github.com/apache/seatunnel/pull/10505#issuecomment-4087064422
Hi @yzeng1618
I've added the e2e tests for HDFS, FTP, and SFTP regarding `sync_mode=update` and `recursive_file_scan=false`.
All tests are passing in CI.
Could you please review it again?
--
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
Re: [PR] [Feature][Connector-V2] Add recursive_file_scan option for file connectors [seatunnel]
Posted by "yzeng1618 (via GitHub)" <gi...@apache.org>.
yzeng1618 commented on PR #10505:
URL: https://github.com/apache/seatunnel/pull/10505#issuecomment-3988295090
<img width="1091" height="285" alt="image" src="https://github.com/user-attachments/assets/eb90a42d-dcb0-4c94-9d7d-2bd8dc6a49ce" />
Update the code and resolve the conflicts along the way.
--
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
Re: [PR] [Feature][Connector-V2] Add recursive_file_scan option for file connectors [seatunnel]
Posted by "MyeoungDev (via GitHub)" <gi...@apache.org>.
MyeoungDev commented on PR #10505:
URL: https://github.com/apache/seatunnel/pull/10505#issuecomment-4159161343
Hi @zhangshenghang,
Could you please help take a final look when you have time, or let me know if anything else is needed before merge?
Thank you!
--
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
Re: [PR] [Feature][Connector-V2] Add recursive_file_scan option for file connectors [seatunnel]
Posted by "MyeoungDev (via GitHub)" <gi...@apache.org>.
MyeoungDev commented on PR #10505:
URL: https://github.com/apache/seatunnel/pull/10505#issuecomment-3960424351
@DanielCarter-stack Thanks for your detailed review!
I have updated the PR based on your feedback. Here are my responses to each point
### Issue 1. Regarding the seatunnel.sh script
I did not make any changes to the `seatunnel.sh` script in this PR.
Could you please double-check the diff?
If I missed something or if there is a misunderstanding, please let me know, and I’ll look into it right away.
### Issue 2. Test case for recursive_file_scan
Thank you for the great suggestion.
I have added additional test cases to verify the `recursive_file_scan` option to ensure it works as expected.
### Issue 5. OssJindoFileSourceFactory Update
I have updated the `OssJindoFileSourceFactory` as requested.
### Issue 6. Test Resource Cleanup
Regarding the potential failure of test resource cleanup, I have updated the code to ensure that any cleanup issues are properly recorded in the logs.
### Issue3 Issue 7. Documentation issues
I initially felt the descriptions for the options were sufficient, but if you feel the recursive_file_scan option needs more detailed explanation, I am happy to expand it.
Additionally, please note that I am not familiar with Chinese.
If updates to the Chinese documentation are required, please provide a guide or specific template, and I will follow it accordingly.
--
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
Re: [PR] [Feature][Connector-V2] Add recursive_file_scan option for file connectors [seatunnel]
Posted by "yzeng1618 (via GitHub)" <gi...@apache.org>.
yzeng1618 commented on PR #10505:
URL: https://github.com/apache/seatunnel/pull/10505#issuecomment-4028073397
> @yzeng1618 Thanks for the feedback.
>
> I'll use the LocalFile connector to verify the `recursive_file_scan` option by creating a multi-level directory structure and checking the row count in the E2E module.
>
> I will let you know once I've pushed the updates.
For E2E, we don't need to cover every connector — I'd suggest adding just two more types of E2E tests (e.g., HDFS, S3 or OSS).
--
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
Re: [PR] [Feature][Connector-V2] Add recursive_file_scan option for file connectors [seatunnel]
Posted by "DanielCarter-stack (via GitHub)" <gi...@apache.org>.
DanielCarter-stack commented on PR #10505:
URL: https://github.com/apache/seatunnel/pull/10505#issuecomment-3940694029
<!-- code-pr-reviewer -->
<!-- cpr:pr_reply_v2_parts {"group": "apache/seatunnel#10505", "part": 1, "total": 1} -->
### Issue 1: seatunnel.sh script changes don't match PR theme
**Location**: `seatunnel-core/seatunnel-starter/src/main/bin/seatunnel.sh:44-55`
**Changes**:
```bash
# Original Code
-if [ $# == 0 ]; then
- set -- -h
-fi
-args=("$@")
-args_str=" $* "
# After Modification
+if [ $# == 0 ]
+then
+ args="-h"
+else
+ args=$@
+fi
```
**Problem Description**:
1. This change is **completely unrelated** to the PR title "Add recursive_file_scan option"
2. Modified parameter passing method:
- Original: Uses array `args=("$@")`
- Modified: Uses string `args=$@`
3. Modified parameter matching logic:
- Original: `[[ "$args_str" == *" -m local "* ]]` (matches with spaces before and after)
- Modified: `[[ $args == *" -m local"* ]]` (matches with space before, none after)
**Potential Risks**:
- **Risk 1 (High)**: May fail when parameters contain spaces
```bash
# Scenario
seatunnel.sh -c "my config.conf" # 配置文件路径包含空格
# Original Code
args=("my" "config.conf") # 正确分割为数组
"${args[@]}" # 正确展开为 "my" "config.conf"
# After Modification
args="my config.conf" # 单个字符串
$args # 可能错误展开
```
- **风险 2 (中)**: 参数匹配模式变松,可能误匹配
```bash
# Scenario
seatunnel.sh -m local2 # 应该不匹配 "local"
# Original
[[ "$args_str" == *" -m local "* ]] # 不匹配 (需要前后空格)
# After Modification
[[ $args == *" -m local"* ]] # 误匹配 "local2"
```
- **风险 3 (中)**: 最后的 java 命令调用方式变更
```bash
# Original
java ... "${args[@]}" # 数组展开,正确处理空格和引号
# After Modification
java ... $args # 字符串展开,可能导致 word splitting
```
** Confidence**: High (confirmed through code review)
** Impact Scope**:
- 直接影响: 所有使用 `seatunnel.sh` 脚本的用户
- 间接影响: CI/CD 流程、自动化脚本
- 影响面: 核心启动脚本 (所有连接器)
** Severity**: **CRITICAL** (blocks merging)
** Improvement Suggestions**:
** Option 1**: Remove this change and create an independent PR
```bash
# Restore original code
if [ $# == 0 ]; then
set -- -h
fi
args=("$@")
args_str=" $* "
# ...
java ${JAVA_OPTS} -cp ${CLASS_PATH} ${APP_MAIN} "${args[@]}"
```
** Option 2**: If this change is truly necessary, need to:
1. 在 PR 描述中说明原因
2. 添加充分的测试
3. 修复参数匹配逻辑,避免误匹配:
```bash
if [[ $args =~ (^-m local |--master local)[[:space:]] || $args =~ [[:space:]](-e local |--deploy-mode local)$ ]]; then
```
** Recommendation**: **Option 1** - Remove this change from this PR and submit as an independent Bug Fix PR.
---
# ## Issue 2: Insufficient Test Coverage - Missing Default Value and Boundary Condition Tests
** Location**: `AbstractReadStrategyTest.java:429-464`
** Issue Description**:
当前测试仅覆盖了 `recursive_file_scan=false` 的显式配置场景,缺少以下关键测试:
1. **默认值测试**: 未验证不配置时默认为 `true`
2. **显式 `true` 测试**: 未验证 `recursive_file_scan=true` 的显式配置
3. **空目录场景**: 未验证 `recursive_file_scan=false` + 空目录的行为
4. **只有子目录场景**: 未验证顶层无文件、只有子目录时的行为
5. **多层嵌套场景**: 未验证 `recursive_file_scan=false` 时多层目录的行为
6. **与其他配置的组合测试**:
- 与 `file_filter_pattern` 组合
- 与 `read_partitions` 组合
- 与 `sync_mode=update` 组合
** Confidence**: High (confirmed through test code review)
** Potential Risks**:
- **风险 1**: 未来重构可能意外破坏默认值行为
- **风险 2**: 用户在复杂场景下遇到未预期的行为
- **风险 3**: 回归测试不足,未来引入 Bug
** Impact Scope**:
- 直接影响: 测试覆盖率
- 间接影响: 代码质量保障
- 影响面: 单个测试文件
** Severity**: **MAJOR** (recommended to fix)
** Improvement Suggestions**:
```java
@DisabledOnOs(OS.WINDOWS)
@Test
public void testRecursiveFileScanDefault() throws Exception {
// Test default value (don't configure recursive_file_scan)
String baseDir = "/tmp/test_default";
String file1 = baseDir + "/file1.txt";
String subdirFile = baseDir + "/subdir/file2.txt";
try {
createTestFiles(file1, subdirFile);
Map<String, Object> config = new HashMap<>();
config.put(FileBaseSourceOptions.FILE_PATH.key(), baseDir);
config.put(FileBaseSourceOptions.FILE_FORMAT_TYPE.key(), "text");
// Note: don't configure recursive_file_scan
Config pluginConfig = ConfigFactory.parseMap(config);
try (TextReadStrategy strategy = new TextReadStrategy()) {
ParquetReadStrategyTest.LocalConf localConf =
new ParquetReadStrategyTest.LocalConf(FS_DEFAULT_NAME_DEFAULT);
strategy.init(localConf);
strategy.setPluginConfig(pluginConfig);
List<String> fileNames = strategy.getFileNamesByPath(baseDir);
// Verify default behavior is recursive scanning
Assertions.assertEquals(2, fileNames.size());
Assertions.assertTrue(fileNames.stream().anyMatch(f -> f.contains("subdir")));
}
} finally {
deleteTestDirectory(baseDir);
}
}
@DisabledOnOs(OS.WINDOWS)
@Test
public void testNonRecursiveEmptyDirectory() throws Exception {
// Test empty directory scenario
String baseDir = "/tmp/test_empty";
String subdirDir = baseDir + "/subdir";
try {
Configuration conf = new Configuration();
Path path = new Path(subdirDir);
org.apache.hadoop.fs.FileSystem fs = path.getFileSystem(conf);
fs.mkdirs(path); // Create empty subdirectory
Map<String, Object> config = new HashMap<>();
config.put(FileBaseSourceOptions.FILE_PATH.key(), baseDir);
config.put(FileBaseSourceOptions.FILE_FORMAT_TYPE.key(), "text");
config.put(FileBaseSourceOptions.RECURSIVE_FILE_SCAN.key(), false);
Config pluginConfig = ConfigFactory.parseMap(config);
try (TextReadStrategy strategy = new TextReadStrategy()) {
ParquetReadStrategyTest.LocalConf localConf =
new ParquetReadStrategyTest.LocalConf(FS_DEFAULT_NAME_DEFAULT);
strategy.init(localConf);
strategy.setPluginConfig(pluginConfig);
List<String> fileNames = strategy.getFileNamesByPath(baseDir);
// Verify empty directory returns empty list
Assertions.assertEquals(0, fileNames.size());
}
} finally {
deleteTestDirectory(baseDir);
}
}
@DisabledOnOs(OS.WINDOWS)
@Test
public void testNonRecursiveWithOnlySubdirectories() throws Exception {
// Test scenario with only subdirectories and no top-level files
String baseDir = "/tmp/test_only_subdir";
String subdirFile1 = baseDir + "/subdir1/file1.txt";
String subdirFile2 = baseDir + "/subdir2/file2.txt";
try {
createTestFiles(subdirFile1, subdirFile2);
Map<String, Object> config = new HashMap<>();
config.put(FileBaseSourceOptions.FILE_PATH.key(), baseDir);
config.put(FileBaseSourceOptions.FILE_FORMAT_TYPE.key(), "text");
config.put(FileBaseSourceOptions.RECURSIVE_FILE_SCAN.key(), false);
Config pluginConfig = ConfigFactory.parseMap(config);
try (TextReadStrategy strategy = new TextReadStrategy()) {
ParquetReadStrategyTest.LocalConf localConf =
new ParquetReadStrategyTest.LocalConf(FS_DEFAULT_NAME_DEFAULT);
strategy.init(localConf);
strategy.setPluginConfig(pluginConfig);
List<String> fileNames = strategy.getFileNamesByPath(baseDir);
// Verify subdirectories are not scanned, return empty list
Assertions.assertEquals(0, fileNames.size());
}
} finally {
deleteTestDirectory(baseDir);
}
}
```
---
# ## Issue 3: Documentation Lacks Usage Examples and Interaction Instructions
** Location**:
- `docs/en/connectors/source/LocalFile.md:497-500`
- `docs/zh/connectors/source/LocalFile.md:497-502`
- (其他 8 个连接器文档类似)
** Issue Description**:
当前文档仅包含基本的配置说明,缺少:
1. **实际使用示例**: 未展示如何在真实场景中使用此配置
2. **性能影响说明**: 未提及非递归模式的性能优势
3. **与其他配置的交互**:
- 与隐藏目录 (`.hive-staging_hive`) 的关系
- 与 `read_partitions` 的组合使用
- 与 `file_filter_pattern` 的组合使用
4. **迁移指南**: 未说明现有用户如何评估是否需要调整配置
** Confidence**: High (confirmed through documentation review)
** Potential Risks**:
- **风险 1**: 用户不知道此功能的存在和价值
- **风险 2**: 用户可能误用配置 (如期望提升性能但设置错误)
- **风险 3**: 用户不清楚配置间的优先级和交互
** Impact Scope**:
- 直接影响: 所有文件连接器用户
- 间接影响: 支持工单量
- 影响面: 所有 9 个文件连接器文档
** Severity**: **MAJOR** (recommended to improve)
** Improvement Suggestions**:
在各个连接器文档中添加详细的说明章节:
```markdown
### recursive_file_scan [boolean]
Whether to scan subdirectories recursively. If `false`, subdirectories will be ignored.
**Default value**: `true` (maintains backward compatibility)
**Behavior**:
- When `true`: Recursively scans all subdirectories (default behavior)
- When `false`: Only scans files in the specified directory, ignoring all subdirectories
**Note**: Hidden directories (starting with `.`) are always skipped, regardless of this setting.
This includes directories like `.hive-staging_hive` which are used by Hive as temporary directories.
**Performance Considerations**:
Setting `recursive_file_scan` to `false` can significantly improve performance when:
- You only need files from the top-level directory
- The directory structure is very deep or has many subdirectories
- You want to reduce the initial file discovery time
**Examples**:
**Example 1: Scan only top-level files**
```hocon
source {
LocalFile {
path = "/data/daily"
recursive_file_scan = false # Only read files in /data/daily
file_format_type = "text"
}
}
```
Given this directory structure:
```
/data/daily/
├── file1.txt
├── file2.txt
└── archive/
└── old_data.txt
```
Result: Only `file1.txt` and `file2.txt` will be read.
**Example 2: Recursively scan all files (default)**
```hocon
source {
LocalFile {
path = "/data/daily"
recursive_file_scan = true # or omit this line
file_format_type = "text"
}
}
```
Result: All files in `/data/daily` and its subdirectories will be read.
**Example 3: Combining with partition filtering**
```hocon
source {
LocalFile {
path = "/data"
recursive_file_scan = false # Only discover files in /data
read_partitions = ["dt=20240101"] # Then filter by partition
file_format_type = "parquet"
}
}
```
**Example 4: Combining with file pattern filter**
```hocon
source {
LocalFile {
path = "/data"
recursive_file_scan = false
file_filter_pattern = ".*\\.csv$" # Only CSV files
file_format_type = "csv"
}
}
```
**Migration Guide**:
For existing jobs:
- No action required if you want to keep the current behavior (recursive scanning)
- To improve performance by only scanning top-level files, add `recursive_file_scan = false`
- Test the change in a non-production environment first
**See Also**:
- [file_filter_pattern](#file_filter_pattern-regex)
- [read_partitions](#read_partitions-string-list)
```
---
# ## Issue 4: Field Access Control Lacks JavaDoc Explanation
** Location**: `AbstractReadStrategy.java:126`
** Issue Description**:
```java
public abstract class AbstractReadStrategy implements ReadStrategy {
// ...
protected boolean recursiveFileScan = true;
// ...
}
```
字段 `recursiveFileScan` 被声明为 `protected`,这意味着:
- 所有子类都可以访问和修改此字段
- 子类可能意外覆盖此字段,导致行为异常
** Confidence**: Medium (through code pattern analysis)
** Potential Risks**:
- **风险 1**: 子类可能在构造函数中初始化此字段,覆盖默认值
- **风险 2**: 子类可能在运行时修改此字段,导致并发问题
- **风险 3**: 缺少 JavaDoc 可能导致子类开发者误用此字段
** Impact Scope**:
- 直接影响: 所有 `AbstractReadStrategy` 的子类 (约 10 个)
- 间接影响: 继承层级中的字段可见性
- 影响面: connector-file 模块
** Severity**: **MINOR** (optional improvement)
** Improvement Suggestions**:
** Option 1**: Add JavaDoc comments
```java
/**
* Controls whether to recursively scan subdirectories when collecting file names.
*
* <p>This field is set during {@link #setPluginConfig(Config)} based on the
* {@link FileBaseSourceOptions#RECURSIVE_FILE_SCAN} configuration option.
*
* <p><b>Default value:</b> {@code true} (recursive scanning enabled)
*
* <p><b>Note for subclasses:</b> This field should not be modified directly.
* Subclasses should rely on the configuration mechanism in {@code setPluginConfig()}
* to control this behavior. Modifying this field at runtime may lead to unexpected
* behavior, especially in multi-threaded scenarios.
*
* @see FileBaseSourceOptions#RECURSIVE_FILE_SCAN
* @see #setPluginConfig(Config)
*/
protected boolean recursiveFileScan = true;
```
** Option 2**: Change to `private` and provide getter (stricter, but may break existing subclasses)
```java
private boolean recursiveFileScan = true;
protected boolean isRecursiveFileScan() {
return recursiveFileScan;
}
```
** Recommendation**: **Option 1** - Add detailed JavaDoc, maintain backward compatibility.
---
# ## Issue 5: Missing OssJindoFileSourceFactory Update
** Location**: `seatunnel-connectors-v2/connector-file-connector-file-jindo-oss/`
** Issue Description**:
PR 变更列表中包含:
- ✅ 文档更新: `docs/en/connectors/source/OssJindoFile.md`
- ✅ 文档更新: `docs/zh/connectors/source/OssJindoFile.md`
- ❌ Factory 更新: `OssJindoFileSourceFactory.java` **缺失**
** Verification**:
```bash
$ git diff dev --name-only | grep -i jindo
docs/en/connectors/source/OssJindoFile.md
docs/zh/connectors/source/OssJindoFile.md
```
** Confidence**: High (confirmed through git diff)
** Potential Risks**:
- **风险 1**: 用户配置 `recursive_file_scan` 时,配置验证通过但实际不生效
- **风险 2**: Factory 的 `optionRule()` 未注册此选项,用户配置时可能被忽略或报错
- **风险 3**: 文档与实际行为不一致,导致用户困惑
** Impact Scope**:
- 直接影响: OssJindoFile 连接器用户
- 间接影响: 文档可信度
- 影响面: 单个连接器 (OssJindoFile)
** Severity**: **MAJOR** (needs fixing)
** Improvement Suggestions**:
确认 `OssJindoFileSourceFactory` 的位置并添加配置:
```bash
# Find Factory files
find seatunnel-connectors-v2 -name "*OssJindoFileSourceFactory.java"
```
然后在 `optionRule()` 方法中添加:
```java
@Override
public OptionRule optionRule() {
return OptionRule.builder()
// ... existing rules ...
.optional(FileBaseSourceOptions.RECURSIVE_FILE_SCAN)
.build();
}
```
如果 `OssJindoFileSourceFactory` 不存在或使用不同的基类,需要:
1. 确认其继承关系
2. 添加相应的配置注册逻辑
3. 更新 PR 变更列表
---
# ## Issue 6: Test Resource Cleanup May Fail
** Location**: `AbstractReadStrategyTest.java:480-488`
** Issue Description**:
```java
private void deleteTestDirectory(String dirPath) {
try {
Path path = new Path(dirPath);
Configuration conf = new Configuration();
org.apache.hadoop.fs.FileSystem fs = path.getFileSystem(conf);
fs.delete(path, true);
} catch (Exception e) {
// Empty catch, ignore all exceptions
}
}
```
** Confidence**: Medium (confirmed through code review)
** Potential Risks**:
- **风险 1**: 如果删除失败,测试文件可能累积在 `/tmp/` 目录
- **风险 2**: 异常被静默忽略,无法诊断问题
- **风险 3**: 后续测试可能因文件已存在而失败
** Impact Scope**:
- 直接影响: 测试环境
- 间接影响: CI/CD 稳定性
- 影响面: 单个测试文件
** Severity**: **MINOR** (optional improvement)
** Improvement Suggestions**:
```java
private void deleteTestDirectory(String dirPath) {
try {
Path path = new Path(dirPath);
Configuration conf = new Configuration();
org.apache.hadoop.fs.FileSystem fs = path.getFileSystem(conf);
if (fs.exists(path)) {
fs.delete(path, true);
}
} catch (Exception e) {
// Log exception instead of silently ignoring
System.err.println("Warning: Failed to delete test directory: " + dirPath);
e.printStackTrace();
}
}
```
或者使用测试框架的 `@TempDir` 注解 (JUnit 5):
```java
@Test
@TempDir Path tempDir // Auto cleanup
public void testNonRecursiveFileScan() throws Exception {
String baseDir = tempDir.toAbsolutePath().toString() + "/test";
// ...
}
```
---
# ## Issue 7: Inconsistent Chinese Documentation Description
** Location**:
- `docs/zh/connectors/source/LocalFile.md:501`
- `docs/zh/connectors/source/ObsFile.md:126`
** Issue Description**:
不同连接器的中文文档对 `recursive_file_scan` 的描述略有差异:
**LocalFile.md**:
```markdown
Whether to scan subdirectories recursively.
If set to `false`, subdirectories will be ignored and only files under the specified path will be scanned.
```
**ObsFile.md**:
```markdown
Whether to scan subdirectories recursively. If `false`, subdirectories will be ignored.
```
** Confidence**: High (confirmed through documentation comparison)
** Potential Risks**:
- **风险**: 用户阅读不同文档时可能对功能理解不一致
- **影响**: 降低文档专业性
** Impact Scope**:
- 直接影响: 中文文档读者
- 间接影响: 文档一致性
- 影响面: 中文文档
** Severity**: **MINOR** (optional improvement)
** Improvement Suggestions**:
统一所有连接器的中文文档描述为:
```markdown
### recursive_file_scan [boolean]
Whether to scan subdirectories recursively. If set to `false`, subdirectories will be ignored.
**Default value**: `true` (maintains backward compatibility)
**Description**:
- When set to `true`, recursively scans all subdirectories
- When set to `false`, only scans files under the specified directory, ignoring all subdirectories
**Note**: Hidden directories (starting with `.`) are always skipped, regardless of this setting.
```
--
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