Repository navigation
[Fix][Connector-V2] Support text format in Pulsar source - #11792
Conversation
DanielLeens
left a comment
There was a problem hiding this comment.
What Problem Does This PR Solve?
- User pain point: The Pulsar source's option rule already advertised
format = text(viaPulsarSourceFactory.optionRule().conditional(FORMAT, TEXT_FORMAT, FIELD_DELIMITER)and the existingfield_delimiterdoc row), but the actual runtime path rejected it:PulsarMultiTableConfig.validateFormatthrew "unsupported format" for anything other than JSON/CANAL_JSON/AVRO, andPulsarSource.createDeserializationhad noTEXTbranch, so it would have hit thedefaultclause and thrownSeaTunnelJsonFormatExceptioneven if validation had let it through. This mismatch between advertised capability and runtime behavior is tracked in #11620. - Fix approach: (1) allow
TEXTinvalidateFormatfor single-table configs while explicitly rejecting it fortables_configsentries with a clear error message; (2) add aTEXTcase increateDeserializationthat builds aTextDeserializationSchemausing the table's configuredfield_delimiter; (3) update English/Chinese docs with a new "Read Text Messages" example. - One-sentence summary: This closes the gap between the Pulsar source's advertised
textformat support and its actual (previously broken) validation/deserialization code path, restricted to single-table mode.
1. Code Change Review
1.1 Core Logic Analysis
PulsarMultiTableConfig.validateFormat (seatunnel-connectors-v2/connector-pulsar/src/main/java/org/apache/seatunnel/connectors/seatunnel/pulsar/config/PulsarMultiTableConfig.java:317-339):
// before
if (!Objects.equals("JSON", normalized)
&& !Objects.equals("CANAL_JSON", normalized)
&& !Objects.equals("AVRO", normalized)) { throw ...; }
// after
if (index >= 0 && Objects.equals("TEXT", normalized)) { throw ...; } // multi-table: explicit reject
if (!Objects.equals("JSON", normalized) && !Objects.equals("CANAL_JSON", normalized)
&& !Objects.equals("AVRO", normalized) && !Objects.equals("TEXT", normalized)) { throw ...; }This correctly special-cases index >= 0 (i.e., an entry originating from tables_configs, see parseMultiTable passing i >= 0 vs parseSingleTable passing -1) to keep multi-table TEXT unsupported with a dedicated, more specific error message, while still allowing TEXT through the general allow-list for the single-table path.
PulsarSource.createDeserialization (seatunnel-connectors-v2/connector-pulsar/src/main/java/org/apache/seatunnel/connectors/seatunnel/pulsar/source/PulsarSource.java:265-291): the signature was changed from (String format, CatalogTable) to (PulsarTableConfig, CatalogTable) so the new TEXT branch can pull field_delimiter out of tableConfig.getSchemaConfig(). The one call site (line 203) was updated accordingly. The new branch:
case "TEXT":
return TextDeserializationSchema.builder()
.seaTunnelRowType(catalogTable.getSeaTunnelRowType())
.delimiter(tableConfig.getSchemaConfig().get(PulsarSourceOptions.FIELD_DELIMITER))
.setCatalogTable(catalogTable)
.build();Key Findings:
tableConfig.getSchemaConfig()is never null on either the single-table (parseSingleTablepasses the wholeReadonlyConfig config) or multi-table (parseMultiTablepasses the mergedtableConfig) construction paths, so there is no NPE risk here.FIELD_DELIMITERhas a default value of","(PulsarBaseOptions.java:80-83), so.get(...)never returns null even if the user omitsfield_delimiter— noNonNullviolation inTextDeserializationSchema's constructor.- This exact
.seaTunnelRowType(...).delimiter(...).setCatalogTable(...).build()builder pattern is verified to match the established convention used byRocketMqSourceConfig.java:259-263, so the PR is consistent with how other connectors wire upTextDeserializationSchema. - Because
validateFormatalready blocks TEXT fortables_configs(index >= 0) beforecreateDeserializationis ever reached for a multi-table entry, the newTEXTcase in the switch is only exercised via the single-table path, matching the stated restriction end-to-end (config validation and deserialization construction are consistent with each other). - No recovery/checkpoint/serialization/async-callback path is touched —
createDeserializationruns synchronously duringPulsarSourceconstruction (createConsumerMetadata, invoked from the constructor), so a full cross-thread runtime-path trace is not required per protocol; this is plain constructor-time wiring, not a checkpoint/restore or cross-node data-flow change.
1.2 Compatibility Impact
Fully compatible. Before this PR, format = text unconditionally threw PulsarConnectorException (CONFIG_VALIDATION_FAILED) during config parsing, so no working job could have relied on the old rejection behavior. All existing formats (JSON, CANAL_JSON, AVRO) keep identical validation and deserialization behavior — the new TEXT branch is strictly additive on both validateFormat and createDeserialization, and the multi-table restriction is preserved (now with a friendlier error message).
1.3 Performance / Side-Effect Analysis
No hot-path impact. createDeserialization runs once per table at source construction time, not per-record. TextDeserializationSchema construction and delimiter lookup are O(1) config reads. No new dependencies, no additional allocations in the read loop.
1.4 Error Handling and Logging
No issues found in error handling for this diff. The new validation error for multi-table TEXT rejection includes the config prefix (tables_configs[i] ('tablePath')) consistent with all other validation errors in this file, giving actionable context. No sensitive data is logged or included in exception messages.
2. Code Quality Assessment
2.1 Coding Standards
The changed createDeserialization method retains its original (undocumented) state — no Javadoc was added or removed, consistent with the rest of the file's style for private helper methods. No new public API, non-trivial field, or class was introduced, so the "new methods/fields must have comments" bar does not strictly apply here; this is a low-risk, localized change. No blocking coding-standard issues.
2.2 Test Coverage and Test Stability
Two positive/negative test additions were verified:
PulsarMultiTableConfigTest.shouldAllowTextFormatInSingleTableandshouldRejectTextFormatInTablesConfigs(.../config/PulsarMultiTableConfigTest.java) — directly exercisePulsarMultiTableConfig.of(...)with real config maps, asserting both the accepted single-table case and the specific exception message for the multi-table rejection.PulsarSourceTest.shouldDeserializeTextWithConfiguredFieldDelimiter(.../source/PulsarSourceTest.java) — constructs a realPulsarSourcewith a custom|delimiter, reaches intoconsumerMetadataMapvia reflection to grab the actualTextDeserializationSchemainstance, and asserts ondeserialize(...)output field values. This is a genuine behavioral test of the actual runtime deserialization path (not a mock-only test), which directly proves the fix.
No Thread.sleep, no nondeterministic assertions, no shared static state, no ordering dependency between tests — all new tests are synchronous, self-contained unit tests operating on in-memory config/objects only.
Stability rating: Stable.
2.3 Documentation Updates
docs/en/connectors/source/Pulsar.md and docs/zh/connectors/source/Pulsar.md were both updated in lockstep: the format option table row, the ### format [String] prose, and a new "Read Text Messages" / "读取 Text 消息" example section with a full working config snippet (including schema block). English and Chinese docs are consistent with each other and with the code (text in the supported list, single-table-only restriction called out). This satisfies the repo's "any user-visible change MUST update docs/en and docs/zh" requirement.
3. Architectural Soundness
3.1 Elegance of the Solution
Precise fix. The change is minimal and targeted: it closes exactly the gap between the pre-existing option-rule declaration (TEXT_FORMAT conditional was already wired into PulsarSourceFactory.optionRule() before this PR) and the runtime validation/deserialization code, without touching unrelated formats, the sink side, or the multi-table topic-discovery machinery.
3.2 Maintainability
The createDeserialization signature change (String format → PulsarTableConfig tableConfig) is a small, well-contained refactor with a single call site updated; it makes the method self-sufficient to add future per-table format options without further signature churn.
3.3 Extensibility
Adding a new format in the future follows the same two-touch-point pattern already established (validateFormat allow-list + createDeserialization switch case), so this change reinforces rather than complicates that pattern.
3.4 Historical-Version Compatibility
No config option names, defaults, or serialized state formats were changed. No SPI/API contract was altered. Existing jobs configured with json, canal_json, or avro are unaffected; jobs previously using text could not have existed since that configuration always failed validation.
4. Issue Summary
No blocking issues found.
| Number | Issue | Location | Severity |
|---|---|---|---|
| - | None | - | - |
5. Merge Recommendation
Conclusion: Ready to merge
No blocking issues found. The fix is minimal, correctly restricts TEXT to single-table mode at both the validation and deserialization layers, matches the established TextDeserializationSchema.builder() usage pattern from RocketMqSourceConfig, and is backed by genuine (non-mocked) unit tests that exercise the real deserialization path. Docs (en/zh) are updated consistently with the code.
Remaining risk / blind spot (non-blocking): CI on the fork currently shows "Unable to detect the workflow run" (Build check = action_required), which appears to be because GitHub Actions has not been enabled on the contributor's fork rather than any problem with the diff itself.
Good job.
Thanks a lot for your valuable contribution to Apache SeaTunnel!
To pass the automated CI checks for this PR, could you please enable CI workflows in your forked repository first? You can refer to the check run link below as a reference for the required CI configuration https://github.com/apache/seatunnel/runs/94389736185
If you run into any trouble enabling CI or encounter related errors during the process, feel free to leave a comment here. Contributors are always ready to offer help~
- Blockers — none.
- Recommended fixes — non-blocking: consider adding a short note to the "Read Text Messages" example clarifying that
schemais required for text format to get a multi-field row (as shown in the example) versus the single-content-field fallback used whenschemais omitted, since this may not be obvious to users coming from the JSON/AVRO examples.
Overall assessment: this is a well-scoped, correctly-implemented bug fix with solid test coverage; no changes requested.
|
Thanks for your contribution! This is a solid addition to the project, and your attention to detail really shows. Contributors like you are what keep this community moving forward. Feel free to keep the PRs coming — we're always glad to have you here! Please ignore the following message if you have joined in the Slack~ |
DanielLeens
left a comment
There was a problem hiding this comment.
What Problem Does This PR Solve?
- User pain point:
PulsarSourceFactory.optionRule()already advertisedformat = text(.conditional(PulsarSourceOptions.FORMAT, PulsarSourceOptions.TEXT_FORMAT, PulsarSourceOptions.FIELD_DELIMITER)inseatunnel-connectors-v2/connector-pulsar/src/main/java/org/apache/seatunnel/connectors/seatunnel/pulsar/source/PulsarSourceFactory.java), but the actual runtime path rejected it:PulsarMultiTableConfig.validateFormatthrew "unsupported format" for anything other than JSON/CANAL_JSON/AVRO, andPulsarSource.createDeserializationhad noTEXTcase, so it would have fallen intodefaultand thrownSeaTunnelJsonFormatExceptioneven if validation had let it through. - Fix approach: (1) allow
TEXTinvalidateFormatfor single-table configs while explicitly rejecting it fortables_configsentries with a dedicated error message; (2) add aTEXTcase increateDeserializationthat builds aTextDeserializationSchemausing the table's configuredfield_delimiter; (3) update English/Chinese docs with a new "Read Text Messages" example. - One-sentence summary: closes the gap between the Pulsar source's advertised
textformat support and its actual (previously broken) validation/deserialization code path, restricted to single-table mode.
Re-verification note (this is a re-review)
I reviewed this PR previously at commit bd295d9c5529a25086487d6332312622b28be5bb (COMMENTED). The only activity since then is:
- A new commit
22c19468784330aac94cd04a9cde7814644494d5titled "ci: trigger fork workflow" —git diff bd295d9c55 22c1946 --statis completely empty, confirming this is a zero-file no-op commit created only to re-kick the fork's Actions run. - A boilerplate welcome-bot comment from
davidzollo(2026-08-13T16:05:14Z) — not a substantive review, no technical content.
Per protocol I re-read the ENTIRE current diff from scratch against apache/dev rather than trusting my earlier notes, and independently re-traced every claim against the actual current source (not just the PR description):
PulsarMultiTableConfig.java:317-339(current head): confirmed theindex >= 0 && TEXTearly-reject branch runs before the general allow-list check, and thatvalidateFormatis invoked fromvalidateTableConfig, which bothparseSingleTable(index-1) andparseMultiTable(indexi) call before ever constructing aPulsarTableConfig. Verified against the full method bodies ofparseSingleTable/parseMultiTable(lines 82-245) —schemaConfigpassed intovalidateTableConfigis always the non-nullconfig(single-table) or mergedtableConfig(multi-table), so there is no NPE surface here.PulsarSource.java: confirmedPulsarMultiTableConfig.of(config)runs in the constructor (line ~85) strictly beforecreateConsumerMetadata(which is wherecreateDeserializationis invoked). This means a multi-tableTEXTrequest is rejected byvalidateFormatbefore the newTEXTswitch case increateDeserializationcould ever be reached — the two code paths are consistent with each other, exactly as claimed previously.FIELD_DELIMITERdefault: re-confirmed inPulsarBaseOptions.java:68-83—DEFAULT_FIELD_DELIMITER = ",", so.get(FIELD_DELIMITER)never returns null even if the user omits it.- Builder-pattern convention check: re-diffed against
RocketMqSourceConfig.java's existingTEXTcase (TextDeserializationSchema.builder().seaTunnelRowType(...).delimiter(config.get(...FIELD_DELIMITER)).setCatalogTable(...).build()) — the new Pulsar code follows the identical established pattern used elsewhere in the codebase. - Docs: re-diffed
docs/en/connectors/source/Pulsar.mdanddocs/zh/connectors/source/Pulsar.md— both option tables and theformatprose were updated together, and both add a matching "Read Text Messages" / "读取 Text 消息" example whosefield_delimiter = "|"/schema { id = int, name = string }matches the shape asserted in the new unit test. - Tests: re-read
PulsarMultiTableConfigTest.shouldAllowTextFormatInSingleTable/shouldRejectTextFormatInTablesConfigs, andPulsarSourceTest.shouldDeserializeTextWithConfiguredFieldDelimiter. The last one constructs a realPulsarSourcevia its production constructor, pulls the actualDeserializationSchemaout of the privateconsumerMetadataMapvia reflection, and assertsdeserialize("1|Alice".getBytes(UTF_8))producesrow.getField(0) == 1androw.getField(1) == "Alice". This exercises the true runtime call chain end-to-end (constructor ->PulsarMultiTableConfig.of->validateFormatallow ->createConsumerMetadata->createDeserialization->TextDeserializationSchema.build()->deserialize()), not just a mock or the config layer in isolation. NoThread.sleep, no shared static state, no ordering dependency — this is a synchronous, deterministic unit test.
Conclusion: my prior technical findings all hold on re-verification, unchanged. Compatibility remains fully additive (before this PR format = text unconditionally threw PulsarConnectorException, so no working job could depend on the old rejection), no hot-path/perf impact (createDeserialization runs once per table at construction time, not per record), and error handling/logging is unchanged and adequate (contextual tables_configs[i] ('tablePath') prefixes, no sensitive data).
CI / Merge-Gate Diagnosis
gh pr view shows mergeStateStatus: BLOCKED, mergeable: MERGEABLE, reviewDecision: REVIEW_REQUIRED — i.e. blocked purely on missing review approval plus a failing status check, not a real merge conflict.
The apache-side "Build" check (a pointer, per this project's usual CI wiring) is FAILURE. Tracing to the real run in the contributor's fork (1322630531/seatunnel, run 31692136795, triggered by the 22c1946 "ci: trigger fork workflow" commit):
unit-test (11, windows-latest): successunit-test (8, windows-latest): failure — the actual breakunit-test (8, ubuntu-latest)andunit-test (11, ubuntu-latest): cancelled as a side effect of the Windows job failing- Every other job (Code style, License header, all
updated-modules-integration-test-*,Build website, etc.) succeeded or was correctly skipped by path filtering
The one real failure is:
[ERROR] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 311.358 s <<< FAILURE!
- in org.apache.seatunnel.engine.server.master.JobStateCleanupDelayTest
inside the seatunnel-engine-server module during a Windows JVM run. This PR's entire diff is confined to seatunnel-connectors-v2/connector-pulsar/** and docs/** — it does not touch seatunnel-engine at all, and git diff apache/dev...review-pr-11792 confirms the PR branch is only a single, unrelated, docs-only commit (638c813a88, "[Docs][Connector-V2] Improve OssFile..." ) behind dev — so a "sync latest dev" would not be expected to fix this. This class of Windows-only Zeta-engine unit-test flakiness is a known, actively-worked area in this repo's own history (e.g. bf9be04805 "[Fix][Zeta] Stabilize flaky CI tests for unit-test and jdbc-connectors-it-part-7"), not something this PR's Pulsar-only diff could plausibly cause or fix.
This is not a code-quality blocker. Recommend a job-level rerun of the failing unit-test (8, windows-latest) job specifically (not a full workflow rerun) to clear it; if it passes on rerun, that confirms the flake diagnosis.
4. Issue Summary
| # | Issue | Location | Severity |
|---|---|---|---|
| - | None found | - | - |
5. Merge Recommendation
Conclusion: Ready to merge
- Blockers — must be fixed
- None. No non-CI blocker was found on this from-scratch re-verification of the current diff.
- Recommended fixes — non-blocking
- Rerun the failing
unit-test (8, windows-latest)job in the fork (job-level rerun, not a full workflow rerun) to clear the CI check before merge; the failure is in an unrelated Zeta engine test (JobStateCleanupDelayTest) outside this PR's diff footprint.
- Rerun the failing
Overall assessment: the fix correctly closes the gap between the advertised and actual text-format support for the Pulsar source, is strictly additive/backward-compatible, is consistent with the established TextDeserializationSchema wiring pattern used elsewhere (e.g. RocketMQ), has solid end-to-end test coverage that exercises the real constructor-to-deserialize call chain, and ships matching English/Chinese docs. Approving.
davidzollo
left a comment
There was a problem hiding this comment.
+1 if CI passes.
LGTM
DanielLeens
left a comment
There was a problem hiding this comment.
Thanks for the ping via the new commit — this is a fresh, complete re-review of the current head (c4be6fc60f). Since my last review, the only change is ci: trigger fork workflow-style commit c4be6fc60f ("[Chore] Retrigger CI for PR #11792"), which is a zero-file no-op (git diff 22c1946...c4be6fc60f --stat is empty) — so this round is a from-scratch re-verification against a functionally identical diff to what I approved on 2026-08-14, not a review of new code.
I re-read the entire diff against the latest dev, re-traced the full call chain from scratch (not from my earlier notes), and my prior conclusion holds: no new blocker found.
What Problem Does This PR Solve?
- User pain point: The Pulsar source already advertised
format = textsupport —PulsarSourceFactory.optionRule()has a.conditional(FORMAT, TEXT_FORMAT, FIELD_DELIMITER)binding and the docs mentionedfield_delimiterfor "textformat" — but the runtime path silently rejected it.PulsarMultiTableConfig.validateFormat()only allow-listed JSON/CANAL_JSON/AVRO, so any user settingformat = textgot a config-validation exception before a job could even start, andPulsarSource.createDeserialization()had noTEXTcase either, so it would have hitdefault -> throw SeaTunnelJsonFormatExceptioneven if validation had let it through. This gap is tracked in #11620. - Fix approach: (1) allow
TEXTthroughvalidateFormat()for single-table configs, while explicitly rejecting it fortables_configsentries with a dedicated error message; (2) add aTEXTcase tocreateDeserialization()that builds aTextDeserializationSchemausing the table's configuredfield_delimiter; (3) updatedocs/enanddocs/zhwith a new "Read Text Messages" example. - One-sentence summary: This closes the gap between the Pulsar source's advertised
text-format capability and its previously broken validation/deserialization code path, scoped to single-table mode.
Note on overlapping PRs (#11754 / #11863)
I want to flag something important for maintainers before the merge decision: there are currently three open PRs independently attempting to fix the exact same gap (issue #11620), all touching the same two core files (PulsarMultiTableConfig.java + PulsarSource.java):
| PR | Author | Opened | Files touched | Daniel's status |
|---|---|---|---|---|
| #11754 | @waterWang | 2026-08-10 | PulsarMultiTableConfig.java, PulsarSource.java (no tests, no docs) |
CHANGES_REQUESTED (2026-08-11), no fix pushed since — stalled |
| #11792 (this PR) | @1322630531 | 2026-08-13 | Same two files + tests for both config-validation and actual TEXT deserialization output + docs/en/docs/zh |
APPROVED (2026-08-14), reconfirmed today |
| #11863 | @zhang-arvin | 2026-08-18 | Same two files + config tests, but the deserialization test only asserts construction doesn't throw (no real payload/output assertion) + docs not updated | CHANGES_REQUESTED (2026-08-19) — missing docs update and missing real deserialization-output test |
This PR (#11792) is the furthest along and most complete of the three. It's the only one of the three that (a) has a behavioral unit test that actually feeds a delimited byte payload through the real TextDeserializationSchema obtained from a production PulsarSource instance and asserts field-level output (PulsarSourceTest.shouldDeserializeTextWithConfiguredFieldDelimiter), and (b) ships matching docs/en/docs/zh updates, both of which #11863 is currently missing and #11754 never added. Merging more than one of these would conflict on the same lines of PulsarMultiTableConfig.java/PulsarSource.java, so I'd recommend maintainers merge #11792 and ask the authors of #11754/#11863 to close their PRs in favor of this one (or rebase on top of it if they have something additional to contribute).
1. Code Change Review
1.1 Core Logic Analysis
PulsarMultiTableConfig.validateFormat() (seatunnel-connectors-v2/connector-pulsar/src/main/java/org/apache/seatunnel/connectors/seatunnel/pulsar/config/PulsarMultiTableConfig.java:317-339):
// before
if (!Objects.equals("JSON", normalized)
&& !Objects.equals("CANAL_JSON", normalized)
&& !Objects.equals("AVRO", normalized)) { throw ...; }
// after
if (index >= 0 && Objects.equals("TEXT", normalized)) { throw ...; } // tables_configs entries: explicit reject
if (!Objects.equals("JSON", normalized) && !Objects.equals("CANAL_JSON", normalized)
&& !Objects.equals("AVRO", normalized) && !Objects.equals("TEXT", normalized)) { throw ...; }I re-traced index back to its two call sites: parseSingleTable() always calls validateTableConfig(-1, ...) (line ~98), and parseMultiTable() calls it with the loop index i (0..N-1) for every entry in tables_configs (line ~209) — so index >= 0 really means "config went through tables_configs syntax," not "there is more than one table." A single-entry tables_configs = [{...}] with format = text is still rejected today. This is the same nuance @zhang-arvin's PR (#11863) surfaced as its Issue 1, and it's present here too — but I'd note this PR's error message ("TEXT is only supported in single-table mode") is actually already more accurate than #11863's ("in multi-table mode, only JSON, CANAL_JSON and AVRO are supported"), since it doesn't claim "multi-table" applies when there might be exactly one entry. Given issue #11620's literal ask was "allow TEXT for single-table mode" (i.e., the simple topic/format syntax, not tables_configs), I don't consider this a regression or a blocker — just a minor, pre-existing scope boundary worth a follow-up issue if the community wants tables_configs with a single entry to be treated identically to the simple syntax.
PulsarSource.createDeserialization() (seatunnel-connectors-v2/connector-pulsar/src/main/java/org/apache/seatunnel/connectors/seatunnel/pulsar/source/PulsarSource.java:265-291): signature changed from (String format, CatalogTable) to (PulsarTableConfig, CatalogTable) so the new TEXT branch can read field_delimiter off the table's own config. The single call site (line ~203) was updated accordingly:
case "TEXT":
return TextDeserializationSchema.builder()
.seaTunnelRowType(catalogTable.getSeaTunnelRowType())
.delimiter(tableConfig.getSchemaConfig().get(PulsarSourceOptions.FIELD_DELIMITER))
.setCatalogTable(catalogTable)
.build();Key Findings:
- I independently re-verified
tableConfig.getSchemaConfig()is never null on either construction path:parseSingleTable()(PulsarMultiTableConfig.java:82-127) passes the fullReadonlyConfig configas the constructor'sschemaConfigargument, andparseMultiTable()(lines 129-245) passes the per-entry mergedtableConfig— both are always-non-nullReadonlyConfiginstances, so there's no NPE surface. FIELD_DELIMITERhasdefaultValue(",")(PulsarBaseOptions.java:68,80-83, re-confirmed by direct source read) —.get(...)never returns null even when the user omitsfield_delimiter.- Because
validateFormat()already rejectsTEXTfor anytables_configsentry (index >= 0) before aPulsarTableConfigis even constructed,createDeserialization()'s newTEXTcase is provably only reachable via the single-table path — validation and deserialization are consistent with each other, matching the stated restriction end-to-end. - The
TextDeserializationSchema.builder().seaTunnelRowType(...).delimiter(...).setCatalogTable(...).build()pattern is identical to the existing convention inRocketMqSourceConfig.java:259-263, so this is consistent with how other connectors already wire up text format, not a novel approach. createDeserialization()runs synchronously duringPulsarSourceconstruction (viacreateConsumerMetadata, invoked from the constructor) — this is constructor-time wiring, not a checkpoint/restore, cross-thread, or cross-node data-flow path, so no additional recovery/serialization-boundary analysis is required here.
1.2 Compatibility Impact
Fully compatible. Before this PR, format = text unconditionally threw PulsarConnectorException during config parsing, so no working job could have depended on the old rejection. Existing JSON/CANAL_JSON/AVRO validation and deserialization behavior is byte-for-byte unchanged — both validateFormat() and createDeserialization() changes are strictly additive, and the tables_configs TEXT restriction is preserved (now with a clearer message). No config option renames, no default-value changes, no serialization-format or SPI/API contract changes.
1.3 Performance / Side-Effect Analysis
No hot-path impact. createDeserialization() runs once per table at source construction time, not per record. TextDeserializationSchema construction and the delimiter lookup are O(1) config reads. No new threads, queues, retries, or external dependencies introduced.
1.4 Error Handling and Logging
The new multi-table rejection message includes the standard tables_configs[i] ('tablePath') context prefix used throughout this file, giving actionable diagnostics. Per-message malformed-TEXT handling is delegated entirely to the existing, independently-tested TextDeserializationSchema.deserialize() in seatunnel-format-text — this PR only makes that code path reachable, it doesn't add or change error-handling logic there. No sensitive data in any new log/exception message.
2. Code Quality Assessment
2.1 Coding Standards
The changed methods keep their pre-existing (private helper) style; no new public API surface, no new non-trivial class/field requiring fresh Javadoc. No coding-standard issues.
2.2 Test Coverage and Test Stability
Three new tests were re-verified against the current head:
PulsarMultiTableConfigTest.shouldAllowTextFormatInSingleTable/shouldRejectTextFormatInTablesConfigs— exercisePulsarMultiTableConfig.of(...)with real config maps, asserting both the accepted single-table case and the exact rejection message fortables_configs.PulsarSourceTest.shouldDeserializeTextWithConfiguredFieldDelimiter— constructs a realPulsarSourcewithfield_delimiter = "|", pulls the actualDeserializationSchemainstance out of the privateconsumerMetadataMapvia reflection, callsdeserialize("1|Alice".getBytes(UTF_8)), and assertsrow.getField(0) == 1/row.getField(1) == "Alice". This is a genuine, end-to-end behavioral test of the real runtime path (constructor →PulsarMultiTableConfig.of→validateFormat→createConsumerMetadata→createDeserialization→TextDeserializationSchema.build()→deserialize()), not a mock or a config-layer-only check — and it's notably more thorough than the equivalent test in #11863, which only asserts construction doesn't throw.
No Thread.sleep, no nondeterministic assertions, no shared static state, no execution-order dependency, no containers, no network I/O — all three new tests are synchronous and fully self-contained.
Stability rating: Stable. No flaky-test anti-patterns identified in the new test code.
2.3 Documentation Updates
docs/en/connectors/source/Pulsar.md and docs/zh/connectors/source/Pulsar.md were both updated in lockstep: the format option-table row, the ### format [String] prose, and a matching new "Read Text Messages" / "读取 Text 消息" example (with field_delimiter = "|" and a schema { id = int, name = string } block that matches the shape asserted in the new unit test). English and Chinese docs are consistent with each other and with the code's actual behavior (including the single-table-only restriction).
3. Architectural Soundness
3.1 Elegance of the Solution
Precise fix. Minimal and targeted — it closes exactly the gap between the pre-existing option-rule declaration and the runtime validation/deserialization code, without touching the sink side, other formats, or the multi-table topic-discovery machinery.
3.2 Maintainability
The createDeserialization signature change (String format → PulsarTableConfig tableConfig) is small and well-contained, with a single call site updated. It makes the method self-sufficient for future per-table format options without further signature churn.
3.3 Extensibility
Adding a future format follows the same established two-touch-point pattern (validateFormat allow-list + createDeserialization switch case) — this PR reinforces that pattern rather than working around it.
3.4 Historical-Version Compatibility
No config option names, defaults, or serialized-state formats changed. No SPI/API contract altered. Existing json/canal_json/avro jobs are unaffected; jobs previously configured with text could not have existed, since that configuration always failed validation before this PR.
4. Issue Summary
| # | Issue | Location | Severity |
|---|---|---|---|
| - | No blocking issues found. See "Note on overlapping PRs" above for a non-code, community-coordination item. | - | - |
5. Merge Recommendation
Conclusion: Ready to merge
-
Blockers — must be fixed
- None. This from-scratch re-verification of the current head found no new or previously-missed code-side blocker.
-
Recommended fixes — non-blocking
- Consider clarifying whether a single-entry
tables_configs = [{...}]withformat = textshould be allowed (see theindex >= 0discussion in 1.1) — currently it's rejected identically to a genuine multi-table config. This matches issue #11620's literal scope, so it's not a regression, just a possible follow-up. - Consider adding a short doc note clarifying that
schemais required to get a multi-field row fortextformat (as shown in the new example), versus the single-content-field fallback used whenschemais omitted, since users coming from the JSON/AVRO examples may not expect this.
- Consider clarifying whether a single-entry
CI diagnosis: The apache-side "Build" check currently shows FAILURE. Tracing to the real fork run (1322630531/seatunnel, run 32235309726, triggered by the latest no-op c4be6fc60f commit): unit-test (11, windows-latest) failed with
[ERROR] CheckpointPlanTest>AbstractSeaTunnelServerTest.before:70 » IllegalState Node failed to start!
inside seatunnel-engine-server, while unit-test (8/11, ubuntu-latest) and unit-test (8, windows-latest) were cancelled as a side effect, and every lane relevant to this PR's actual diff — Code style, License header, and all updated-modules-integration-test-* jobs (which cover connector-pulsar) — passed. This PR's diff is confined entirely to seatunnel-connectors-v2/connector-pulsar/** and docs/**; it doesn't touch seatunnel-engine at all. "Node failed to start!" on windows-latest is a known, recurring, environment-level Hazelcast-on-Windows flake in this repo (I've now seen it on 4 separate unrelated PRs, hitting a different test class each time), not something this PR's diff could plausibly cause. Recommend a job-level rerun of unit-test (11, windows-latest) specifically (not a full workflow rerun) to clear it.
Overall assessment: this is a well-scoped, correctly-implemented, backward-compatible fix with genuine behavioral test coverage and consistent bilingual docs — the strongest and most complete of the three open PRs targeting issue #11620. No changes requested from me; the only thing standing between this and merge is the unrelated Windows CI flake plus the cross-PR duplication noted above, which I'd flag to maintainers as a coordination item rather than a code problem.
Nice work on this — the level of care in the tests (actually exercising the real deserialization path end-to-end, not just checking construction) is exactly what makes a fix like this trustworthy. Thanks again for the contribution!
davidzollo
left a comment
There was a problem hiding this comment.
+1
LGTM
Thanks for your contribution! This is a solid addition to the project, and your attention to detail really shows. Contributors like you are what keep this community moving forward. Feel free to keep the PRs coming — we're always glad to have you here!
Please ignore the following message if you have joined in the Slack~
To facilitate focused communication among contributors, we’ve created a brand-new dedicated #contributors channel in official Slack workspace.
Slack workspace link: https://s.apache.org/seatunnel-slack
This channel is designed for technical discussions, feature design brainstorming, roadmap sync and direct communication with project core Contributors. Everyone who contributes code, docs, test cases or community ideas is warmly invited to join, share thoughts and collaborate together under The Apache Way. Welcome to join 😄
Co-authored-by: DanielLeens <escheduler@outlook.com> Co-authored-by: davidzollo <davidzollo@users.noreply.github.com>
Purpose of this pull request
Fixes #11620.
Pulsar Source advertises
format = text, but its runtime validation and deserialization path reject it. This patch:textin single-table source configuration;TextDeserializationSchemawith the configuredfield_delimiter;Does this PR introduce any user-facing change?
Yes.
Previously, a single-table Pulsar Source configured with
format = textfailed validation (and would also fail during deserializer creation). After this change, text messages are deserialized according to the configured schema andfield_delimiter. Multi-table mode continues to support only JSON, CANAL_JSON, and AVRO.How was this patch tested?
|delimiter.tables_configs.Check list