SEZ9 opened a new pull request, #13426:
URL: https://github.com/apache/seatunnel/pull/13426
Yes — glad to contribute this to Apache SeaTunnel.
Closes #13418.
### What Problem Does This PR Solve?
Planner output is free text, so a connector name arrives in whatever
spelling the model produced. The metadata lookup was exact, so names whose
metadata exists still missed:
```
No metadata found for source:jdbc
No metadata found for transform:SQLTransform
No metadata found for sink:File
```
When that happens the generator receives no option rules for that connector
and has to guess option keys — precisely the situation metadata injection
exists to prevent. It also fails silently: the run continues and the only trace
is a warning in the log.
### What Changed
`canonicalize_connector(name, plugin_type)` returns `(canonical_name,
candidates)` and resolves **spellings of the same name** only:
| given | resolves to | why |
| --- | --- | --- |
| `jdbc`, `JDBC`, `jDbC` | `Jdbc` | case carries no meaning in a plugin name
|
| `mysql-cdc`, `MYSQL_CDC`, `MySqlCdc` | `MySQL-CDC` | separators carry no
meaning |
| `SQLTransform` | `Sql` | a transform with its kind spelled out |
| `File` | **nothing** — candidates returned | see below |
It runs as a third tier inside `fetch_connector_metadata`, reached **only
after the name as given has already failed**, so any lookup that worked before
takes exactly the path it took before.
### Why `File` is not resolved to `LocalFile`
This is the one place I diverged from the original suggestion in our
internal findings, which proposed `File -> LocalFile` as a compatibility
mapping. `plugin-mapping.properties` in this repo registers **13** connectors
ending in `File`:
```
BosFile ClickhouseFile CosFile FtpFile GcsFile HdfsFile LocalFile
ObsFile OssFile OssJindoFile S3File SftpFile SmbFile
```
Picking one would point a job at the wrong storage system, which is a worse
outcome than the warning it replaces — a silent wrong answer instead of a
visible gap. So an ambiguous name resolves to nothing and the candidates are
returned and named in the log:
```
No metadata found for sink:File — registered names it could mean: HdfsFile,
LocalFile, OssFile, S3File, SftpFile
```
### How Was This Patch Tested?
`seatunnel-cli` suite: **446 passed** (431 before, 15 added), `ruff check .`
clean.
Mutation testing found a bug in my own new function, which is worth
reporting rather than quietly fixing: several connectors are registered under
more than one type (`Jdbc` is both a source and a sink), so an unscoped lookup
saw `Jdbc` twice and reported it as ambiguous with itself:
```
canonicalize_connector("jdbc") -> (None, ['Jdbc', 'Jdbc'])
```
The index is now de-duplicated, and both that case and the genuinely
ambiguous one have tests. Final mutation results:
| Mutation | Result |
| --- | --- |
| drop the third tier | 2 failed |
| guess the first candidate when ambiguous | 1 failed |
| drop the de-duplication | 1 failed |
| none | 15 passed |
New file `tests/test_connector_canonical_names.py` covering: case and
separator spellings, the transform suffix, the ambiguous-`File` case, type
scoping, a name registered under two types, two distinct names that normalise
alike, an unavailable registry, the fallback finding metadata, a name that
already matches not being rewritten, and both log shapes.
### Compatibility
- No new or changed configuration options, no changed defaults, no public
API removed. `canonicalize_connector` is new; nothing existing changes
signature.
- **Only the previously-failing path changes.** The third tier is reached
after tiers 1 and 2 have both returned nothing, verified by a test asserting
`canonicalize_connector` is not called when the name already matches.
- Recursion terminates: the retry is only issued when `canonical !=
plugin_name`, and `canonical` is a registered name, so the next frame matches
exactly and cannot recurse again.
- An unavailable registry returns `(None, [])` rather than raising, so hosts
with no exported metadata behave as before.
### Docs
No documentation change: this is internal name resolution with no
user-facing option, command or output change. The improved warning is log
output, not documented behaviour.
### Check list
* [x] Code changed are covered with tests, or it does not need tests for
reason
* [x] 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)
— no new dependency
* [x] If necessary, please update the documentation to describe the new
feature — not user-visible
* [x] If you are contributing the connector code, please check that the
following files are updated — not a connector change
🤖 Generated with [Claude Code](https://claude.com/claude-code)
--
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]