det101 opened a new pull request, #11242:
URL: https://github.com/apache/seatunnel/pull/11242
### Purpose of this pull request
Follow-up to #11101 (PR1) for #11047: extend the shared sink `table_options`
contract to **StarRocks SaveMode auto-create**.
This PR lets users pass StarRocks table properties (for example
`replication_num`, `storage_format`) via `table_options` when
`schema_save_mode` triggers DDL. Options are merged into the generated `CREATE
TABLE ... PROPERTIES (...)` clause.
**Scope (StarRocks only; builds on merged PR1):**
- Reuse `SinkConnectorCommonOptions.TABLE_OPTIONS` (already on `dev` from
#11101)
- Early validation via `Conditions.extension` in
`StarRocksSinkFactory.optionRule()` (same pattern as JDBC PR1)
- Merge properties with `SqlTableClauseMerger` in `connector-common`
- Pass `table_options` through `StarRocksCatalog` constructor (not
`CatalogTable.options`) to avoid upstream metadata pollution in CDC /
multi-table jobs
- Reject non-empty `table_options` when `save_mode_create_template` differs
from the built-in default (custom templates must embed properties in the
template itself)
**Out of scope:** JDBC changes (already in #11101), new `seatunnel-api`
types, E2E in this PR.
### Does this PR introduce _any_ user-facing change?
Yes.
- New optional StarRocks sink config: `table_options` (map), using the
common option introduced in #11101.
- Applied only when SaveMode auto-creates tables
(`CREATE_SCHEMA_WHEN_NOT_EXIST`, `RECREATE_SCHEMA`, etc.).
- Does **not** affect Stream Load at runtime and does **not** run `ALTER
TABLE` on existing tables.
- **Not compatible** with a **custom** `save_mode_create_template`
(validation fails at `--check` / job submission); use template `PROPERTIES`
instead.
- With the **default** template, duplicate keys in `PROPERTIES` are
overridden by `table_options`.
- No StarRocks property allowlist; invalid keys fail when StarRocks executes
`CREATE TABLE`.
- Documentation updated: `docs/en/connectors/sink/StarRocks.md`,
`docs/zh/connectors/sink/StarRocks.md`.
### How was this patch tested?
**Unit tests added/updated:**
- `SqlTableClauseMergerTest` — merge / override / append `PROPERTIES`
- `StarRocksSaveModeUtilTableOptionsTest` — validation + SQL merge
- `StarRocksTableOptionsConditionExtensionTest` — `optionRule` / `--check`
path
- `StarRocksCreateTableTest` — end-to-end SQL generation with `table_options`
- `PreviewActionTest` — preview SQL uses sink `table_options` only (not
upstream `CatalogTable.options`)
**Commands run locally:**
```bash
./mvnw spotless:apply -pl
seatunnel-connectors-v2/connector-common,seatunnel-connectors-v2/connector-starrocks
./mvnw test -pl
seatunnel-connectors-v2/connector-common,seatunnel-connectors-v2/connector-starrocks
\
-Dtest=SqlTableClauseMergerTest,StarRocksSaveModeUtilTableOptionsTest,\
StarRocksTableOptionsConditionExtensionTest,StarRocksCreateTableTest,PreviewActionTest
```
### Check list
### Check list
- [ ] If any new Jar binary package adding in your PR, please add License
Notice according to
[New License
Guide](https://github.com/apache/seatunnel/blob/dev/docs/en/developer/new-license.md)
- [x] 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
--
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]