SEZ9 opened a new pull request, #13420:
URL: https://github.com/apache/seatunnel/pull/13420

   Yes — glad to contribute this to Apache SeaTunnel.
   
   Closes #13415.
   
   ### What Problem Does This PR Solve?
   
   When a plan needs more than one transform, `seatunnel-cli` used the whole 
list as a single connector name, so the metadata lookup could never match.
   
   `PipelineSlot.transform` is typed `str | None`, but `parse_structured_plan` 
fills it straight from the planner's JSON:
   
   ```python
   transform=p.get("transform"),
   ```
   
   with no normalisation — unlike `source`/`sink`, which are unwrapped from 
their object form (`src.get("connector", "") if isinstance(src, dict) else 
str(src)`). So the field arrives as whatever the model emitted. 
`_transform_connector_name` handled a string and an object, and a list fell 
through to `str(transform)`:
   
   | plan field | plugin name looked up (before) |
   | --- | --- |
   | `"Sql"` | `Sql` |
   | `{"connector": "Sql", ...}` | `Sql` |
   | `["Sql", "FieldMapper"]` | `['Sql', 'FieldMapper']` |
   | `[{"connector": "Sql"}, {"connector": "FieldMapper"}]` | `[{'connector': 
'Sql'}, {'connector': 'FieldMapper'}]` |
   
   Nothing matches those last two, so `fetch_connector_metadata` logged `No 
metadata found for transform:['Sql', 'FieldMapper']` and the pipeline received 
**no** transform option rules — leaving the generator to invent option keys for 
precisely the connectors that metadata injection exists to pin down. It failed 
silently: the run continued and the only trace was a warning.
   
   ### How Was This Patch Tested?
   
   `seatunnel-cli` suite: **436 passed** (431 before, 5 added), `ruff check .` 
clean.
   
   The new tests are load-bearing, not just passing — removing the list branch 
turns 3 of them red:
   
   ```
   FAILED test_every_transform_in_a_list_gets_its_own_metadata_lookup
   FAILED test_pipeline_prompt_names_each_transform_instead_of_a_python_repr
   3 failed, 12 passed
   ```
   
   Added to the existing `ConnectorMetadataSyncTest`, which already covers 
transform metadata, rather than a new test class:
   
   - every transform in a list gets its own lookup (`Sql` **and** `FieldMapper`)
   - a list of transform objects resolves each connector
   - a single transform object still resolves (regression guard)
   - an empty list adds no lookup
   - the generator prompt names each transform instead of carrying a Python repr
   
   ### What Changed
   
   `_transform_connector_names()` replaces `_transform_connector_name()` and 
returns every name, recursing so a list of objects resolves the same way a bare 
object does and nested empties drop out instead of becoming `"None"`. 
`_metadata_targets_for_pipeline()` adds one target per transform.
   
   The same field was also rendered raw into the generator's prompt:
   
   ```python
   parts.append(f"- Transform: {p.transform}")     # - Transform: ['Sql', 
'FieldMapper']
   ```
   
   That is the same cause and a two-line fix, so it is included here rather 
than left as a second trivial PR; the prompt now reads `- Transform: Sql, 
FieldMapper`.
   
   ### Compatibility
   
   - No new or changed configuration options, no changed defaults, no public 
API change. `_transform_connector_name` was private with a single call site and 
no test referencing it (`grep` over `seatunnel_cli/` and `tests/` confirms), so 
it is replaced rather than left as dead code.
   - Single-string and single-object transforms resolve exactly as before, 
covered by the regression guard above.
   - Downstream de-duplication is unchanged: `fetch_all_metadata` already 
de-dupes by `(name, type)` and `fill_and_check` by option key, so a pipeline 
repeating a transform does not fetch twice.
   
   ### Docs
   
   No documentation change: this is an internal metadata-resolution fix with no 
user-facing option, command or output change.
   
   ### 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]

Reply via email to