You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@seatunnel.apache.org by "JacobZheng0927 (via GitHub)" <gi...@apache.org> on 2026/08/20 03:29:53 UTC

[PR] [Fix][Connector-V2][Jdbc] Bind PostgreSQL JSON and UUID with native types [seatunnel]

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

   ### Purpose of this pull request
   
   PostgreSQL `json`, `jsonb`, and `uuid` columns can be represented as SeaTunnel strings. Binding those values with `setString` makes the driver infer a varchar parameter, which can fail for prepared statements where PostgreSQL cannot infer the intended native type.
   
   This patch binds these source types as typed `PGobject` values so the PostgreSQL JDBC driver receives the correct `json`, `jsonb`, or `uuid` parameter type.
   
   ### Does this PR introduce _any_ user-facing change?
   
   Yes, as a bug fix. JDBC sink writes to PostgreSQL JSON, JSONB, and UUID columns now use native PostgreSQL parameter types rather than varchar inference.
   
   ### How was this patch tested?
   
   Added `PostgresJdbcRowConverterTest` coverage that verifies the generated `PGobject` type and value for `json`, `jsonb`, and `uuid`.
   
   Validated locally with JDK 8 against PostgreSQL 9.6.8: the connector converter inserted JSON, JSONB, and UUID values into native columns; `pg_typeof` returned `json`, `jsonb`, and `uuid`, and the stored JSON fields and UUID matched the input.
   
   Focused unit test result: 13 tests run, 0 failures, 0 errors.
   
   ### Check list
   
   * [x] No new Jar binary package is added.
   * [x] Documentation and incompatible-change updates are not required for this bug fix.
   * [x] No new connector, plugin mapping, distribution dependency, or connector configuration is required.
   


-- 
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: commits-unsubscribe@seatunnel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [Fix][Connector-V2][Jdbc] Bind PostgreSQL JSON and UUID with native types [seatunnel]

Posted by "DanielLeens (via GitHub) via commits" <co...@seatunnel.apache.org>.
DanielLeens commented on PR #11892:
URL: https://github.com/apache/seatunnel/pull/11892#issuecomment-6682774644

   Thanks @JacobZheng0927. A quick gate update on the unchanged head `7c0b24465d`: CI is still green (the apache [Build](https://github.com/apache/seatunnel/runs/126428862204) check now reports success, matching the fork run cited in my last review), but one fact from that review has changed. GitHub now reports a merge conflict with `dev`, so my earlier note that no sync was needed no longer holds.
   
   Suggested next step: when you push the fix for Issue 1 (Greenplum native-driver binding, with the loader-level test and the docs sentence), please also merge the latest `dev` and resolve the conflict in the same update. The new head will need fresh checks and a re-review. My source conclusion is otherwise unchanged.


-- 
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: commits-unsubscribe@seatunnel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [Fix][Connector-V2][Jdbc] Bind PostgreSQL JSON and UUID with native types [seatunnel]

Posted by "JacobZheng0927 (via GitHub)" <gi...@apache.org>.
JacobZheng0927 commented on PR #11892:
URL: https://github.com/apache/seatunnel/pull/11892#issuecomment-5366762538

   Fixed the Spark CI regression from the `org.postgresql.util.PGobject` classpath. Native `PGobject` binding now remains on PostgreSQL/postgresLow only; OpenGauss, DSQL, and HighGo keep their prior `setString` binding. Added regression coverage for those three paths.
   
   Validation: `PostgresJdbcRowConverterTest` 16/16 passed and `spotless:check` passed locally with JDK 8. Force-pushed `ffcc85f59`.


-- 
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: commits-unsubscribe@seatunnel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [Fix][Connector-V2][Jdbc] Bind PostgreSQL JSON and UUID with native types [seatunnel]

Posted by "DanielLeens (via GitHub)" <gi...@apache.org>.
DanielLeens commented on PR #11892:
URL: https://github.com/apache/seatunnel/pull/11892#issuecomment-5363681434

   Thanks @davidzollo — agreed on the direction, but I want to flag that CI is currently failing for a reason that traces directly back to this PR's diff, not an unrelated flake, so we shouldn't merge on green-CI faith yet.
   
   **The `Build` check is currently failing** (fork run: https://github.com/JacobZheng0927/seatunnel/actions/runs/32328300864), specifically in `connector-jdbc-e2e-part-7` → `JdbcOpenGaussIT` under the **Spark** engine job:
   
   ```
   Exception in thread "main" org.apache.seatunnel.core.starter.exception.CommandExecuteException: Run SeaTunnel on spark failed
   Caused by: java.lang.NoClassDefFoundError: org/postgresql/util/PGobject
   Caused by: java.lang.ClassNotFoundException: org.postgresql.util.PGobject
   ```
   (same failure reproduced in both matrix shards 8 and 11, so it's deterministic, not a one-off flake)
   
   Root cause, traced through the diff:
   - `JdbcOpenGaussIT`'s `CREATE_SQL` (`seatunnel-e2e/.../JdbcOpenGaussIT.java`) only has one PG-object-relevant column: `uuid_col UUID`. There's no `geometry`/`inet`/`interval` column in this table, so this test never previously exercised any `PGobject`-typed write path.
   - Before this PR, `uuid_col` fell through to the generic branch and was written with `statement.setString(...)` — no dependency on `org.postgresql.util.PGobject` at write time.
   - This PR's new branch in `PostgresJdbcRowConverter.setValueToStatementByDataType` (`.../dialect/psql/PostgresJdbcRowConverter.java`) now routes `PG_UUID` (and `PG_JSON`/`PG_JSONB`) through `new PGobject(); statement.setObject(...)`, so the write path now hard-requires the `org.postgresql.util.PGobject` class to be resolvable at runtime.
   - Under the Zeta engine that class is resolvable (plugin classloader has the pgjdbc driver jar), but under the **Spark** engine job in this E2E module it is not — hence `NoClassDefFoundError` only in the "Run SeaTunnel on spark failed" leg, and only now that `uuid_col` actually goes through `PGobject`.
   
   So this isn't a pre-existing/unrelated CI issue we can wait out — it's this PR's own new code path hitting a real classloader gap between the Zeta and Spark execution paths for `org.postgresql.util.PGobject`. Given the existing `geometry`/`inet`/`macaddr`/`interval` `PGobject` branches directly above the new code were apparently never covered by a Spark-engine E2E test with those column types, this may be a latent issue in that pre-existing code too — but this PR is what makes it observable and blocking, since `uuid_col` is a real column in this suite.
   
   @JacobZheng0927 could you take a look at why `org.postgresql.util.PGobject` isn't resolvable under the Spark job's classloader in this module (e.g. is the postgres driver dependency scope/shading different between the Zeta and Spark JDBC connector artifacts, or is it a Spark `--jars`/executor classpath assembly gap)? Once you have a fix, please push it and I'll re-review the updated head — happy to help dig into the Spark classpath assembly if useful.
   
   Given this, I'm holding off on re-affirming "ready to merge" until the Spark-engine failure above is actually resolved (not just re-run) — the `mergeStateStatus: BLOCKED` here reflects a real bug, not just a required-check gate.
   


-- 
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: commits-unsubscribe@seatunnel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [Fix][Connector-V2][Jdbc] Bind PostgreSQL JSON and UUID with native types [seatunnel]

Posted by "DanielLeens (via GitHub)" <gi...@apache.org>.
DanielLeens commented on PR #11892:
URL: https://github.com/apache/seatunnel/pull/11892#issuecomment-6473900302

   Thanks for the contribution. The merge-gate fact cited in my previous conclusion has changed: GitHub now reports a real merge conflict. This follow-up corrects that gate on the unchanged reviewed head; it is not another full source review or a sync request based only on being behind.
   
   Gate snapshot (2026-10-28T15:58:03+00:00), head `3e9edc496c750edfb464466dd6032ac7da529862`: [Build](https://github.com/apache/seatunnel/runs/121485086937) is `SUCCESS`.
   
   CI is green, but that does not remove the separate conflict gate below. My [previous source conclusion](https://github.com/apache/seatunnel/pull/11892#pullrequestreview-5643594775) and any independent source requests remain as recorded; no new effective approval or dismissal is performed by this clarification.
   
   Separately, GitHub reports merge conflicts with `dev`. Please sync the latest base and resolve the conflicts first; the resulting new head needs checks and re-review. This conflict gate is independent of CI and existing source findings.
   


-- 
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: commits-unsubscribe@seatunnel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [Fix][Connector-V2][Jdbc] Bind PostgreSQL JSON and UUID with native types [seatunnel]

Posted by "davidzollo (via GitHub)" <gi...@apache.org>.
davidzollo commented on PR #11892:
URL: https://github.com/apache/seatunnel/pull/11892#issuecomment-6394006391

   Continued the original PR at `3e9edc496c75` and merged the current `dev` without rewriting author history.
   
   The connection-config factory overload introduced in #12792 bypassed the original two-argument vendor factory overrides. HighGo/OpenGauss now preserve vendor string binding through the actual runtime loader, including PostgreSQL low compatibility mode, identifier configuration, numeric-special-value policy, and dialect serialization. OpenGauss keeps the existing three-argument PostgreSQL SQL behavior, while its older two-argument vendor behavior remains unchanged.
   
   Regression coverage now exercises those loader paths, all three compatible-driver string types, and a real PostgreSQL prepared-statement `pg_typeof` check for native `json`/`jsonb`/`uuid`. English/Chinese JDBC sink notes describe the binding boundary. The remote twelve-file diff contains no POM changes. Formatting/whitespace checks passed, and GitHub reports no merge conflict. GitHub CI has not completed on this new head; the regression additions are not being reported as executed locally.
   


-- 
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: commits-unsubscribe@seatunnel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org