seatunnel icon indicating copy to clipboard operation
seatunnel copied to clipboard

[Bug] [Connector-V2] Pulsar Source declares text format support but runtime rejects it

Open Dream95 opened this issue 4 months ago • 9 comments

Search before asking

  • [x] I had searched in the issues and found no similar issues.

What happened

Pulsar Source option contract and factory OptionRule claim that format = text is supported, but the runtime validation and deserialization path reject it.

Contract / docs mismatch:

  1. PulsarBaseOptions.FORMAT description says: Optional text and avro format
  2. PulsarSourceFactory OptionRule binds field_delimiter when format = text
  3. Source docs still document field_delimiter for text format

Runtime behavior:

  1. PulsarMultiTableConfig.validateFormat() only allows JSON, CANAL_JSON and AVRO (also applied to single-table configs)
  2. PulsarSource.createDeserialization() has no TEXT branch and throws Unsupported format: text

As a result, configuring Pulsar Source with format = text fails during config validation / source initialization.

Note: Pulsar Sink already supports text format via TextSerializationSchema. The dependency seatunnel-format-text is already present in connector-pulsar.

SeaTunnel Version

dev (master)

SeaTunnel Config

env {
  parallelism = 1
  job.mode = "BATCH"
}

source {
  Pulsar {
    topic = "persistent://public/default/test-topic"
    client.service-url = "pulsar://localhost:6650"
    admin.service-url = "http://localhost:8080"
    subscription.name = "seatunnel-sub"
    cursor.startup.mode = "EARLIEST"
    cursor.stop.mode = "LATEST"
    format = text
    field_delimiter = ","
    schema = {
      fields {
        id = "int"
        name = "string"
      }
    }
  }
}

sink {
  Console {}
}

Running Command

./bin/seatunnel.sh --config config/pulsar_text_source.conf -e local

Error Exception

org.apache.seatunnel.connectors.seatunnel.pulsar.exception.PulsarConnectorException:
Pulsar source config uses unsupported format 'text', only JSON, CANAL_JSON and AVRO are supported

If validation were bypassed, deserialization would still fail with:

Unsupported format: text

Zeta or Flink or Spark Version

Zeta (local)

Java or Scala Version

Java 8 / 11

Screenshots

N/A

Root Cause

Layer Behavior for text
PulsarBaseOptions.FORMAT Declares text as optional
PulsarSourceFactory OptionRule Conditional field_delimiter for text
PulsarMultiTableConfig.validateFormat() Rejects text
PulsarSource.createDeserialization() No TEXT case
Pulsar Sink Text is supported

Expected Behavior

  1. Implement text format for Pulsar Source (recommended, aligns with OptionRule / Sink / seatunnel-format-text dependency), including:
    • Allow text in validateFormat() for single-table mode
    • Add TextDeserializationSchema in createDeserialization() using field_delimiter
    • Keep multi-table restriction explicit if text remains unsupported there
    • Update docs/en and docs/zh Source Pulsar docs accordingly

Dream95 avatar Aug 01 '26 14:08 Dream95

Could a committer please add the help wanted label to this issue? I don't have permission to label it myself. Thanks!

Dream95 avatar Aug 01 '26 15:08 Dream95

Thanks for the careful report and for pointing out the contract/runtime mismatch.

I checked the current dev code path and this looks valid:

  1. PulsarBaseOptions.FORMAT documents text and field_delimiter.
  2. PulsarSourceFactory exposes field_delimiter when format = text.
  3. PulsarMultiTableConfig.validateFormat() currently only allows JSON, CANAL_JSON, and AVRO.
  4. PulsarSource.createDeserialization() also has no TEXT branch, so bypassing validation would still fail at runtime.

I also checked for an obvious open PR covering Pulsar Source text support and did not find one. So the issue should be treated as a real Connector-V2 bug rather than only a documentation problem.

The likely implementation path is:

  1. decide whether text should be supported only for single-table Pulsar Source mode, while keeping the multi-table restriction explicit;
  2. add the source-side text deserialization path using the existing text format support and field_delimiter;
  3. add focused source factory/config tests and a deserialization test;
  4. update both docs/en and docs/zh so the documented source behavior matches the runtime.

I'll mark this as bug / connectors-v2 / help wanted. A contributor can pick it up from the code paths above.

DanielLeens avatar Aug 01 '26 18:08 DanielLeens

I'd like to work on this

vedanth1101-source avatar Aug 02 '26 05:08 vedanth1101-source

Confirmed mismatch: PulsarBaseOptions.FORMAT and PulsarSourceFactory OptionRule advertise text format, but PulsarMultiTableConfig.validateFormat() only allows JSON/CANAL_JSON/AVRO and PulsarSource.createDeserialization() has no TEXT branch.

Preferred fix is to add TEXT support to the source using TextDeserializationSchema (seatunnel-format-text is already a dependency, and the sink already supports text). This should include adding TEXT to validateFormat(), a TEXT branch in createDeserialization() honoring field_delimiter, and an e2e/unit test.

If text support is intentionally not planned for the source, the alternative is to remove text from the option description, the OptionRule conditional binding, and the source docs to keep the contract consistent. Please indicate which direction you'd like; a PR is welcome either way.

SEZ9 avatar Aug 02 '26 05:08 SEZ9

Confirmed contract mismatch: PulsarBaseOptions.FORMAT and PulsarSourceFactory OptionRule advertise 'text' (with field_delimiter), but PulsarMultiTableConfig.validateFormat() only allows JSON/CANAL_JSON/AVRO and PulsarSource.createDeserialization() has no TEXT branch.

Preferred fix: add TEXT support to the source using TextDeserializationSchema (seatunnel-format-text is already a dependency, and the sink already supports text via TextSerializationSchema). Add a TEXT branch in createDeserialization(), allow TEXT in validateFormat(), and cover it with an e2e/unit test.

Alternative if text source support is intentionally unsupported: remove 'text' from FORMAT description, drop the field_delimiter binding for text in PulsarSourceFactory, and update the source docs accordingly. Please indicate which direction is desired; a PR would be welcome.

SEZ9 avatar Aug 03 '26 04:08 SEZ9

Reviewed community PR #11631 for this issue. The implementation wires TEXT into validation and TextDeserializationSchema, and the existing dependency/API path is compatible.\n\nBefore it is mergeable, the PR still needs:\n- Spotless fixes in PulsarSource.java; the module spotless:check reproduces these failures.\n- A regression test for single-table TEXT plus custom field_delimiter, and preferably a tables_configs case.\n- The invalid-format error text updated to include TEXT.\n\nGitHub Build is currently failing because the contributor's fork has not enabled CI. I requested changes on #11631 and will recheck the PR after a new head/green checks.

nielifeng avatar Aug 03 '26 07:08 nielifeng

bug多多,特别是新版本。能跑通靠运气! 2026-08-04 18:39:59,509 INFO [o.a.s.e.c.j.ClientJobProxy ] [main] - Job (1136971568304357377) end with state FAILED 2026-08-04 18:39:59,510 INFO [c.h.c.LifecycleService ] [main] - hz.client_1 [seatunnel] [5.1] HazelcastClient 5.1 (20220228 - 21f20e7) is SHUTTING_DOWN 2026-08-04 18:39:59,513 INFO [.c.i.c.ClientConnectionManager] [main] - hz.client_1 [seatunnel] [5.1] Removed connection to endpoint: [localhost]:5801:ea1164cd-d812-4a1a-b059-7260b027b6ed, connection: ClientConnection{alive=false, connectionId=1, channel=NioChannel{/127.0.0.1:60830->localhost/127.0.0.1:5801}, remoteAddress=[localhost]:5801, lastReadTime=2026-08-04 18:39:59.498, lastWriteTime=2026-08-04 18:39:55.619, closedTime=2026-08-04 18:39:59.512, connected server version=5.1} 2026-08-04 18:39:59,514 INFO [c.h.c.LifecycleService ] [main] - hz.client_1 [seatunnel] [5.1] HazelcastClient 5.1 (20220228 - 21f20e7) is CLIENT_DISCONNECTED 2026-08-04 18:39:59,517 INFO [c.h.c.LifecycleService ] [main] - hz.client_1 [seatunnel] [5.1] HazelcastClient 5.1 (20220228 - 21f20e7) is SHUTDOWN 2026-08-04 18:39:59,517 INFO [s.c.s.s.c.ClientExecuteCommand] [main] - Closed SeaTunnel client...... 2026-08-04 18:39:59,517 INFO [s.c.s.s.c.ClientExecuteCommand] [main] - Closed metrics executor service ...... 2026-08-04 18:39:59,517 ERROR [o.a.s.c.s.SeaTunnel ] [main] -

===============================================================================

2026-08-04 18:39:59,518 ERROR [o.a.s.c.s.SeaTunnel ] [main] - Fatal Error,

2026-08-04 18:39:59,518 ERROR [o.a.s.c.s.SeaTunnel ] [main] - Please submit bug report in https://github.com/apache/seatunnel/issues

2026-08-04 18:39:59,518 ERROR [o.a.s.c.s.SeaTunnel ] [main] - Reason:SeaTunnel job executed failed

2026-08-04 18:39:59,519 ERROR [o.a.s.c.s.SeaTunnel ] [main] - Exception StackTrace:org.apache.seatunnel.core.starter.exception.CommandExecuteException: SeaTunnel job executed failed at org.apache.seatunnel.core.starter.seatunnel.command.ClientExecuteCommand.execute(ClientExecuteCommand.java:266) at org.apache.seatunnel.core.starter.SeaTunnel.run(SeaTunnel.java:40) at org.apache.seatunnel.core.starter.seatunnel.SeaTunnelClient.main(SeaTunnelClient.java:40) Caused by: org.apache.seatunnel.engine.common.exception.SeaTunnelEngineException: java.lang.RuntimeException: java.lang.RuntimeException: java.util.concurrent.ExecutionException: org.apache.seatunnel.connectors.doris.exception.DorisConnectorException: ErrorCode:[Doris-01], ErrorDescription:[stream load error] - stream load error: [LABEL_ALREADY_EXISTS]TStatus: errCode = 2, detailMessage = Label [test-cdc_mydb_t1_1136971568304357377_0_1] has already been used, relate to txn [2066], status [PREPARE]., see more in null

spihiker avatar Aug 04 '26 10:08 spihiker

Confirmed mismatch on dev: PulsarBaseOptions.FORMAT description and PulsarSourceFactory OptionRule bind field_delimiter for format=text, but validateFormat() only allows JSON, CANAL_JSON, AVRO and createDeserialization() has no TEXT branch. Either the source should implement text deserialization or the contract/docs should drop text.

Preferred fix seems to be adding TEXT support: seatunnel-format-text is already a dependency of connector-pulsar, so adding a TEXT branch using TextDeserializationSchema (honoring field_delimiter) plus updating validateFormat() should align runtime with the declared contract. A contribution with an e2e/unit test would be welcome.

If maintainers decide text should not be supported on the source side, please also remove field_delimiter binding from PulsarSourceFactory's OptionRule and update the Pulsar source docs to avoid misleading users.

SEZ9 avatar Aug 05 '26 06:08 SEZ9

I would like to work on this issue.

zhang-arvin avatar Aug 18 '26 22:08 zhang-arvin