karthik-0306 opened a new pull request, #12573:
URL: https://github.com/apache/seatunnel/pull/12573
### Purpose of this pull request
Part of umbrella issue #11007 (migrate connector/transform validation from
imperative `if`/`throw` checks to declarative `optionRule()` + `Conditions.*`).
`PaimonSourceFactory`, `PaimonSinkFactory`, and `PaimonCatalogFactory`
previously declared `warehouse`, `database`, and `table` as plain
`.required(OPT)`. An empty string satisfies `.required()` since it is a
non-null present value, so blank values for these options currently pass
`ConfigValidator` at job submission and only surface as problems later, at
runtime.
This PR migrates those options to `.required(OPT,
Conditions.notBlank(OPT))`, so blank/whitespace-only values are rejected
declaratively at `--check` time, before any catalog or filesystem connection is
attempted.
Scope is strictly limited to the declarative rule layer: no new options, no
change to required/optional status or types, no runtime connectivity checks, no
changes to `PaimonConfig` or `PaimonSinkConfig`. `catalog_uri` and source
`table` (in `.exclusive()` with `table_list`) are deliberately left untouched.
> **Note on `database`/`table`:** `PaimonSinkFactory#renameCatalogTable()`
has a `StringUtils.isNotEmpty(...)` fallback that substitutes the incoming
`CatalogTable`'s name/schema when the config value is absent. This was
introduced in b0abbd2 (#6449) for multi-table sink routing, where the option is
**omitted entirely** — not configured as an explicit blank string. No existing
e2e config or documentation uses an empty string for these options. Calling
this out explicitly as the one place adjacent to runtime logic, and would
appreciate a second look here specifically.
### Does this PR introduce _any_ user-facing change?
Yes. Configs with blank (`""` or whitespace-only) values for `warehouse`,
`database`, or `table` will now fail at job submission with an
`OptionValidationException`, instead of proceeding to runtime. This affects
unreleased `dev` only — no released version documents or supports blank values
for these options.
Non-blank values with surrounding whitespace (e.g. `" /path/to/warehouse "`)
continue to pass unchanged; `notBlank` trims internally for the check only and
does not modify the config value.
### How was this patch tested?
Added `PaimonNotBlankValidationTest` using
`ConfigValidator.of(ReadonlyConfig.fromMap(config)).validate(factory.optionRule())`
against all three factories.
Coverage per touched option: valid config, missing option, empty string
(`""`), whitespace-only (`" "`), and a padded nonblank value (confirms no new
trimming side-effect is introduced).
Full `connector-paimon` module: **107 tests, 0 failures, 0 errors — BUILD
SUCCESS**.
### 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/developer/new-license.md)
> Not applicable — no new Jar binary packages added.
* [x] If necessary, please update the documentation to describe the new
feature. https://github.com/apache/seatunnel/tree/dev/docs
> Updated: `docs/en/connectors/sink/Paimon.md`,
`docs/en/connectors/source/Paimon.md`, `docs/zh/connectors/sink/Paimon.md`,
`docs/zh/connectors/source/Paimon.md` — added "Must not be blank." /
"不能为空白字符串。" to affected options.
* [ ] If necessary, please update `incompatible-changes.md` to describe the
incompatibility caused by this PR.
> Not required — existing valid configurations (non-blank values) are
unaffected. Change targets unreleased `dev` only.
* [ ] 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
> Not applicable — no new connector.
2. Update the pom file of
[seatunnel-dist](https://github.com/apache/seatunnel/blob/dev/seatunnel-dist/pom.xml)
> Not applicable — no new connector.
3. Add ci label in
[label-scope-conf](https://github.com/apache/seatunnel/blob/dev/.github/workflows/labeler/label-scope-conf.yml)
> Not applicable — existing connector, label already exists.
4. Add e2e testcase in
[seatunnel-e2e](https://github.com/apache/seatunnel/tree/dev/seatunnel-e2e/seatunnel-connector-v2-e2e/)
> Not added — existing e2e Paimon configs all use non-blank values;
this change is at the declarative validation layer only, consistent with other
accepted PRs in #11007.
5. Update connector
[plugin_config](https://github.com/apache/seatunnel/blob/dev/config/plugin_config)
> Not applicable — no new connector.
--
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]