Skip to content

[Feature][Connector-V2][Paimon] Support REST catalog for source and sink - #13141

Merged
davidzollo merged 3 commits into
apache:devfrom
goutamadwant:feature/paimon-rest-catalog
Nov 17, 2026
Merged

davidzollo merged 3 commits into
apache:devfrom
goutamadwant:feature/paimon-rest-catalog

Conversation

@goutamadwant

Copy link
Copy Markdown
Collaborator

Purpose of this pull request

Closes #13140. Related: #10967, #10968.

Adds catalog_type = rest for the Paimon source, sink, catalog factory and SaveMode path. REST reuses catalog_uri, takes warehouse as the managed warehouse name, and forwards Paimon 1.1.1's token.provider, token, dlf.access-key-id, dlf.access-key-secret, dlf.security-token and dlf.region. No dependency upgrade.

Only explicitly configured Hadoop settings are passed to the REST catalog, so Hadoop's built-in defaults cannot override server-supplied defaults; REST option keys inside paimon.hadoop.conf or XML files are rejected. catalog_uri must be HTTP or HTTPS with a host and no user information (plain HTTP outside loopback logs a warning), token.provider must be bear or dlf with the matching credentials present, and REST catalogs are closed when no longer used. DLF credentials are masked in the parsed-config log; encryption behaviour is unchanged. filesystem and hive are unchanged.

Does this PR introduce any user-facing change?

Yes: a new catalog_type value and the authentication options above, documented in the EN and ZH source and sink guides, including what is not supported (DLF token loaders and refresh) and two dependency limits (Paimon's HadoopUtils DEBUG logging can print storage settings; Paimon's HTTP client forwards x-dlf-security-token across host redirects). Existing configurations are unaffected.

How was this patch tested?

  • Unit tests fail before the change and pass after: REST option forwarding, explicit-only storage options, reserved-key rejection, URI and credential validation, catalog closure, and unchanged filesystem/Hive option maps. 129 Paimon unit tests and ConfigBuilderTest pass on JDK 11 and 17.
  • PaimonRestCatalogIT (3 tests) against Paimon's REST test server on JDK 11 and 17: SaveMode table creation, write and commit, read-back through the source, discovery, wrong-token rejection, DLF request signing, and server-supplied storage defaults.
  • Not covered: live DLF, remote storage authorization, credential refresh, Flink and Spark engines.

Check list

  • If any new Jar binary package adding in your PR, please add License Notice according to the New License Guide (test-scoped only; no new distributed dependency)
  • Update documentation to describe the new feature
  • Update incompatible-changes.md if necessary (not needed: additive)
  • Check the connector integration files (plugin mapping, dist pom, label scope and plugin config unchanged; the REST IT joins the existing Paimon e2e module)

Signed-off-by: Goutam Adwant <workwithgoutam@gmail.com>

@DanielLeens DanielLeens left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot for this feature, @goutamadwant. REST catalog support has been requested for a while (#10967 / #10968), and the PR is careful about security: credentials are validated without echoing their values, REST-reserved keys are rejected in the Hadoop storage map, and the docs are honest about the Paimon 1.1.1 dependency limits (DEBUG logging in HadoopUtils, redirect forwarding of x-dlf-security-token). I traced the change through the factories, PaimonConfig, PaimonCatalogLoader and the existing catalog lifecycle on dev. I did not find a blocking correctness issue. Below are a few points, mostly about validation depth and small cleanups.

What Problem Does This PR Solve?

The Paimon connector only supported filesystem and hive catalogs. This PR adds catalog_type = rest for source, sink, the catalog factory and the SaveMode path. It reuses catalog_uri as the REST endpoint, treats warehouse as the managed warehouse name, and forwards Paimon 1.1.1's token.provider, token and dlf.* options. No Paimon version upgrade is involved, and the REST classes and the shaded OkHttp client are already in the paimon-bundle 1.1.1 jar the connector ships.

1 Code Change Review

1.1 Core logic

Runtime flow for a REST job:

PaimonSourceFactory / PaimonSinkFactory / PaimonCatalogFactory
  optionRule: conditional(catalog_type == REST -> catalog_uri, token.provider)
  -> new PaimonConfig(readonlyConfig)                         (PaimonConfig.java:81-121)
       catalog_uri required, validateRestUri()                 (:123)
       token.provider in {bear, dlf}; bear -> token; dlf -> both access keys
       dlf.security-token header-character check               (:160)
       restOptions = only the configured REST keys
  -> new PaimonCatalogLoader(config)
       restStorageOptions = explicit XML + paimon.hadoop.conf only, reserved keys rejected
                                                               (PaimonCatalogLoader.java:136-177)
  -> loadCatalog() -> loadRestCatalog()                        (:116-134)
       options = storage + "hadoop."-prefixed storage + warehouse/metastore/uri + restOptions
  -> createCatalog(options) -> CatalogFactory.createCatalog(...)   (:179)
  -> PaimonCatalog.close(): REST catalogs are now closed      (PaimonCatalog.java:87-99)

The filesystem and hive branches of loadCatalog() are unchanged apart from the extraction of createCatalog(...), which contains exactly the previous body (Options, CatalogContext, runSecured, the PrivilegedCatalog check and the PaimonConnectorException wrapping). testFilesystemOptionsUnchanged and testHiveOptionsUnchanged pin that.

1.2 Compatibility

  • Additive only: a new enum value and new optional options. Existing filesystem/hive configs produce the same option maps and the same catalog.
  • warehouse/catalog_uri descriptions change, but their keys and defaults do not.
  • PaimonConfig and PaimonCatalogLoader are Serializable and gain plain HashMap<String, String> fields; nothing is persisted in checkpoint state, so there is no state-compatibility concern.
  • ConfigShadeUtils.java:64-65 (shared core) adds two entries to the existing log-mask-only list. It only affects log masking (not encryption), and the existing suffix/exact matching rules mean it cannot mask unrelated options such as token.provider (covered in ConfigBuilderTest). This is the same kind of one-line addition earlier connectors made.

1.3 Side effects

  • PaimonCatalog.close() now calls catalog.close() for REST catalogs and catches Exception instead of IOException. All existing call sites (PaimonSink, PaimonSinkWriter, PaimonSourceFactory, the SaveMode handler) already close the PaimonCatalog, so the HTTP client is released on the normal path.
  • Source and sink keep using Table objects after the factory has closed its PaimonCatalog. Your IT reads through the source after the factory closed its catalog, which is good evidence that this works with REST tables in a single JVM.

1.4 Error handling / logging

Error messages for an invalid URI or security token deliberately leave out the value, which is the right call for credentials. The HTTP-outside-loopback warning resolves no DNS, which is good.

Issue 1: no engine-level E2E for the REST path

  • Location: seatunnel-e2e/seatunnel-connector-v2-e2e/connector-paimon-e2e/src/test/java/org/apache/seatunnel/e2e/connector/paimon/PaimonRestCatalogIT.java:86-331
  • Problem: PaimonRestCatalogIT is a plain JUnit test in the E2E module. It drives the factories, writer, committer, enumerator and reader directly in the test JVM, with mocked reader/enumerator contexts. It does not extend TestSuiteBase and does not submit a job to a Zeta, Flink or Spark container. That leaves three things unexercised: the plugin classloader of the packaged connector jar, Java serialization of PaimonSource/PaimonSink (and the REST-backed Table/CatalogLoader they carry) to the workers, and commit on the engine side.
  • Risk: medium. These are the usual places a new catalog type breaks in production even when an in-JVM test is green.
  • Best improvement: add one @TestTemplate case that runs a small FakeSource -> Paimon (rest) job and a Paimon (rest) -> Assert job against the REST test server. You can reach the server from the container with Testcontainers.exposeHostPorts, and put the warehouse on a shared bind mount. If that is too heavy for this PR, please say so explicitly in the description and track it as a follow-up. At minimum, add a serialization round-trip of PaimonSource/PaimonSink (via SerializationUtils) to the existing IT.
  • Severity: Medium (strongly recommended; I am not treating it as a hard blocker given the in-JVM coverage)
  • Raised by another reviewer: No

Issue 2: REST-only special case in PaimonCatalog.close() is not explained

  • Location: seatunnel-connectors-v2/connector-paimon/src/main/java/org/apache/seatunnel/connectors/seatunnel/paimon/catalog/PaimonCatalog.java:87-99
  • Problem: the condition is now catalog instanceof Closeable || catalog_type == REST. Readers will not know why REST needs a separate branch (in Paimon 1.1.1 Catalog is AutoCloseable, but the REST catalog chain is not java.io.Closeable), or why other catalog types still keep the old rule.
  • Best improvement: add a short comment that explains this and states that the old rule is kept on purpose for filesystem/hive.
  • Severity: Low
  • Raised by another reviewer: No

Issue 3: reserved-key rejection throws a bare IllegalArgumentException

  • Location: PaimonCatalogLoader.java:163-177
  • Problem: PaimonConfig reports REST validation failures with SeaTunnelException, but the storage-key check throws IllegalArgumentException from the PaimonCatalogLoader constructor. Users get two different error styles for the same kind of misconfiguration.
  • Best improvement: use the same exception type, or a PaimonConnectorException with a config error code, so it is consistent.
  • Severity: Low
  • Raised by another reviewer: No

2 Quality

2.1 Code standards

  • PaimonCatalogLoader.java:139,143,145 use fully qualified org.apache.hadoop.fs.Path and java.nio.file.Path in the method body to avoid the name clash. It would be cleaner to import one of them and keep the other qualified (or use Paths.get(...).toUri() directly), but this is a nit.
  • The non-obvious steps have comments (why storage options are also forwarded with the hadoop. prefix, why DNS is not resolved, why token errors do not echo values). Please also add a brief Javadoc on loadRestStorageOptions saying it reads only explicit settings (Configuration(false)) so Hadoop defaults cannot override what the server supplies. That is the key design decision here.

2.2 Tests

  • PaimonCatalogLoaderTest (new, 21 cases): option forwarding, reserved-key rejection (map and XML), URI and credential validation without echoing values, close behavior, and unchanged filesystem/hive maps. These are precise assertions that would fail if the behavior regressed. Stable (pure in-memory plus temp files).
  • PaimonOptionRuleTest#testRestOptionsDeclaredByAllFactories: makes sure all three factories declare the new options. Stable.
  • ConfigBuilderTest#testPaimonRestCredentialsAreMaskedWithoutChangingEncryptionKeys: checks the core masking change, including the nested dlf { ... } form and that token.provider is not masked. Stable.
  • PaimonRestCatalogIT (3 cases, @Timeout(60)): bearer source/sink/SaveMode round trip, wrong-token rejection, DLF signing, and server-supplied defaults. Stable as far as I can see (local REST test server on an ephemeral port, @TempDir). See Issue 1 for what it does not cover.
  • The connector-paimon-e2e/pom.xml changes are test-scoped. Two small asks: (a) paimon.version is redefined as 1.1.1 at pom.xml:31, which can drift from the connector's own property; please add a comment that it must match connector-paimon, or reuse a shared property. (b) Please explain in the description why connector-cdc-base (pom.xml:67) is needed; nothing in the new IT imports it.

2.3 Documentation

The EN and ZH source and sink pages are updated in parity, with option table rows, authentication rules, examples and known limitations. Very thorough. The new table rows break the column alignment of the existing tables; that is only cosmetic.

3 Architecture

The REST handling stays inside the Paimon connector (config, loader, factories), apart from the two masking keywords in core, which is the right boundary. Delegating to CatalogFactory.createCatalog with metastore = rest instead of instantiating RESTCatalog directly keeps the caching and privilege wrappers consistent with the other catalog types.

4 Issue table

# Location Summary Severity Blocker
1 PaimonRestCatalogIT.java:86-331 No engine-level (container) E2E; serialization and classloader path untested Medium No (strongly recommended)
2 PaimonCatalog.java:87-99 REST-only close condition needs an explanatory comment Low No
3 PaimonCatalogLoader.java:163-177 Inconsistent exception type for REST misconfiguration Low No
4 connector-paimon-e2e/pom.xml:31,67 Duplicated paimon.version; unexplained connector-cdc-base test dependency Low No

5 Merge recommendation

Ready to merge once CI is green, with Issue 1 strongly recommended (either in this PR or as an explicitly tracked follow-up).

Thanks again for the careful, security-conscious implementation.

@DanielLeens DanielLeens left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for keeping this contribution moving. The CI fact cited previously has changed on unchanged head 0a063ee861da1a77415a2fb2603df862061519a2. The previous Paimon REST source conclusion had no blocking source finding; the engine-container test recommendation remains a non-blocking follow-up.

The Apache Build is SUCCESS.

CI was previously the only remaining blocker from my review; CI is now passing, so my technical conclusion is being changed to approve. This does not claim that any separate workflow-approval, maintainer-review or merge-queue gate has been bypassed.

This is an unchanged-head discussion/CI update, not a second full source review. No local tests were run. Daniel has READ permission; any approval records my technical conclusion, while effective maintainer approval, dismissal and merge remain separate.

@DanielLeens DanielLeens left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @goutamadwant, thanks for keeping this branch up to date.

Re-checked the new head 50fc2a73: the only change since my last review (0a063ee8) is a merge of the latest dev (4ee722e9). The PR's own diff is unchanged in substance: the same 18 files with identical added lines. The only touched area is the sensitive-option list in ConfigShadeUtils.java, where dev had added consumer_key / consumer_secret (WooCommerce) after connection_string. The merge keeps both sides. dlf.access-key-id and dlf.access-key-secret are inserted before the WooCommerce keys, nothing is dropped, and ConfigBuilderTest keeps both the Paimon REST masking test and the test that came from dev. That accounts for the one-line difference in the diff stat (a trailing comma).

Previous review points

  • No non-CI blocker in my earlier review, which I approved. The engine-container test idea stays a non-blocking follow-up.

CI

  • The fork Build run on this head is still running: https://github.com/goutamadwant/seatunnel/actions/runs/42765842871. No job has failed yet.
  • Heads-up: this merge took dev at 4ee722e9, one commit before #13203. That commit replaced the removed atmoz/sftp:alpine-3.7 Docker image. This head still uses the old tag, so connector-file-sftp-it (JDK 11/17) is expected to fail, and a rerun won't fix it. The smallest next step is to merge the latest dev once more (1 commit, #13203).

Conclusion: Ready to merge

  • Blockers (non-CI): None.
  • I'll approve again once Build is green on the head that includes #13203.

Thank you for this contribution!

@DanielLeens DanielLeens left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-checked the new head 3d170e4d, @goutamadwant: compared with the head I last reviewed (50fc2a73), the only change is the Sync dev for current CI fixtures merge, and the PR's own net diff against dev is byte-identical (same files, same changed lines). Thanks for syncing.

Previous points: my earlier conclusion had no non-CI blocker, and the merge does not touch the PR's files, so nothing changes on the source side.

CI: the fork Build for this head has just started (no failures so far). Because the head moved, I am leaving this as a comment and will approve once that run is green.

Branch state: ahead, ahead 3 / behind 0 of dev; no conflicts reported.

Conclusion: Ready to merge

  • Blockers (non-CI): none.
  • Remaining gate: CI on this head.

@DanielLeens DanielLeens left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the update on CI. The CI fact cited previously has changed. On unchanged head 3d170e4d0be6a3ffbe99002d7423647dcaf39131, fork Build 42979503587 has completed successfully, and the PR now reports Signal pull request update=SUCCESS; Build=SUCCESS. My earlier pending/missing-workflow guidance is obsolete.

I checked my previous conclusion: no source, test-coverage, compatibility or documentation blocker remained; any listed suggestions were explicitly non-blocking. CI was previously the only remaining blocker; CI is now passing, so the conclusion is being changed to approve.

5. Merge Recommendation

Conclusion: Ready to merge

  1. Blockers — must be fixed: None from my existing source review or current CI. The repository still reports REVIEW_REQUIRED: a write-capable maintainer must provide the effective required review and make the merge decision.
  2. Recommended fixes — non-blocking: Earlier optional suggestions remain optional; no additional source change is requested.

The comparison with dev is diverged, ahead 3 / behind 9, with no reported conflict. This is recorded as branch metadata, not a reason to request a sync while these checks are green. This publication updates the CI gate on an already-reviewed head; it is not a new full source review, and I ran no local build or job. My account has READ permission, so this technical approval must not be confused with a write-capable maintainer's effective approval or dismissal of a historical review entry.

@davidzollo davidzollo left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1
LGTM

Thanks for your contribution!

Please join our Apache SeaTunnel contributors channel on Slack for technical discussions and collaboration: https://s.apache.org/seatunnel-slack

@davidzollo
davidzollo added this pull request to the merge queue Nov 17, 2026
Merged via the queue into apache:dev with commit d208f66 Nov 17, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature][Connector-V2][Paimon] Support REST catalog for source and sink

3 participants