Skip to content

[Fix][Connector-V2] Make JDBC field_ide handling locale independent - #13063

Open
SEPURI-SAI-KRISHNA wants to merge 5 commits into
apache:devfrom
SEPURI-SAI-KRISHNA:fix-jdbc-field-ide-locale
Open

SEPURI-SAI-KRISHNA wants to merge 5 commits into
apache:devfrom
SEPURI-SAI-KRISHNA:fix-jdbc-field-ide-locale

Conversation

@SEPURI-SAI-KRISHNA

@SEPURI-SAI-KRISHNA SEPURI-SAI-KRISHNA commented Oct 29, 2026 •

Copy link
Copy Markdown
Collaborator

Yes, glad to contribute to Apache SeaTunnel.

Purpose of this pull request

Closes #13058.

JdbcDialect.getFieldIde and CatalogUtils.getFieldIde upper cased the field_ide value and converted identifiers with the JVM default locale. Under a Turkish or Azerbaijani locale, "original" upper cases to ORİGİNAL, which is not a FieldIdeEnum constant, and identifiers containing i or I change to İ or ı.

Because JdbcSink uses "original" when field_ide is not set, and createWriter resolves the sink table through CatalogUtils.quoteTableIdentifier for every sink, every JDBC sink without field_ide, or with ORIGINAL, failed to create its writer on such a worker. Measured with a real JdbcSink: createWriter returns a writer under ROOT and throws IllegalArgumentException: No enum constant ...FieldIdeEnum.ORİGİNAL under tr-TR and az-AZ.

The fix. Both methods use Locale.ROOT for the enum lookup and for the identifier conversion. This is the same approach as the merged locale fixes #12996 (in this connector), #12495, #12618 and #12582.

On every other locale, the field_ide value and ASCII identifiers convert exactly as before. No option, default or API changes.

Does this PR introduce any user facing change?

Yes, on workers with a Turkish or Azerbaijani default locale only:

  • a sink without field_ide, or with ORIGINAL, now starts;
  • UPPERCASE and LOWERCASE now produce USER_ID and user_id, where they produced USER_İD and user_ıd. "uppercase" and "lowercase" contain no i, so their enum lookup did not fail on such a worker. A job that created tables or columns there with one of these modes used the dotted or dotless spelling, and now addresses the ASCII one.

This is recorded in incompatible-changes.md in en and zh, with the migration step (rename such names to the ASCII spelling before upgrading). The field_ide section of the JDBC sink documentation, en and zh, now says the conversion uses Locale.ROOT.

How was this patch tested?

Unit tests, one new case in each of three existing test classes, each run under tr-TR and az-AZ:

  • CatalogUtilsTest.testFieldIdeDoesNotDependOnTheDefaultLocale: quoteTableIdentifier("orders", "original"), the call JdbcSink makes for every sink, plus lowercase, uppercase and a qualified name.
  • MysqlDialectTest.testQuoteIdentifierDoesNotDependOnTheDefaultLocale: MysqlDialect.quoteIdentifier with original, lowercase and uppercase, which reaches JdbcDialect.getFieldIde.
  • JdbcSinkTest.createWriterDoesNotDependOnTheDefaultLocale: builds a real JdbcSink (MySQL dialect, query only, field_ide not set) and calls createWriter, the call that failed for every such sink.

All three tests snapshot the base locale and the FORMAT and DISPLAY category defaults and restore them, base first.

Mutation checks:

reverted to dev result
both methods all three tests fail with No enum constant ...FieldIdeEnum.ORİGİNAL
only the identifier conversion CatalogUtilsTest and MysqlDialectTest fail with expected: <user_id> but was: <user_ıd>

E2E. Not added. The failure depends on the default locale of the engine JVM, and the JDBC E2E suites run the engine in a container with that container's default locale, so covering it would mean starting the engine with a Turkish locale for this one case. JdbcSinkTest runs the real JdbcSink.createWriter path instead.

Build checks, JDK 17:

  • JdbcSinkTest, CatalogUtilsTest and MysqlDialectTest on the current head: 27 tests, 0 failures.
  • ./mvnw clean test -pl seatunnel-connectors-v2/connector-jdbc on the first head, with the surefire.jvm.args the unit-test CI lane passes: 1150 tests, 0 failures. 4 errors, all container tests (OracleDialectTest, OracleCatalogTest, KingbaseCatalogContainerTest, KingbaseDialectContainerTest) failing with Could not find a valid Docker environment, because Docker is not available to me.
  • ./mvnw spotless:check -pl seatunnel-connectors-v2/connector-jdbc: clean.
  • ./mvnw -B -T 1 clean test -D"license.skipAddThirdParty"=true -pl seatunnel-ci-tools: 34 tests, 0 failures, 2 skipped by the module.

Check list

  • Code changed are covered with tests, or it does not need tests for reason
  • If any new Jar binary package adding in your PR, please add License Notice according to
    License Notice: none added.
  • If necessary, please update the documentation to describe the new feature: the field_ide section of the JDBC sink documentation, and incompatible-changes.md, in en and zh.
  • If you are contributing the connector code, please check that the following files are updated:
    1. Update plugin-mapping.properties: not needed, no new connector.
    2. Update the pom file of seatunnel-dist: not needed, no new module.
    3. Add ci label in label-scope-conf: not needed, no new module.
    4. Add e2e test for your connector: not added, see above.
    5. Update connector-v2 doc: the JDBC sink document is updated.
  • Update the release-note: not applicable, the file was removed from dev in [Improve] Remove release-note.md in dev branch #9304.

@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 focused JDBC fix! I read all four changed files and traced both helpers through sink creation and dialect SQL generation. Locale.ROOT is the right correction. Two narrow submission gaps remain: the existing JDBC integration path and bilingual behavior/migration guidance.

What Problem Does This PR Solve?

User pain point: A Turkish or Azerbaijani worker can uppercase original into an unrecognized enum name and fail ordinary JDBC sink startup; identifier case conversion can also vary between workers.

Fix approach: Use Locale.ROOT for both field_ide enum parsing and identifier lower/upper conversion in CatalogUtils and JdbcDialect; add tests under both affected locales.

One-sentence summary: With the worker locale tr_TR, field_ide=original should still keep orders unchanged. uppercase user_id should consistently produce USER_ID rather than a dotted-I spelling.

Review report time: 2026-10-29T12:58:12.232057-04:00. Current head 3755991a1268e42a0c780c90cd5e0369fa96e629; base dev at 5598ed7f3a88602032a18b617cb21c688aacf965. Checks: Signal pull request update=QUEUED. Check references: Signal pull request update. Compare: ahead, ahead 1, behind 0; merge state blocked / BLOCKED.

1. Code Change Review

1.1 Core Logic Analysis

CatalogUtils.java:61-78 normalizes field_ide and table/column identifiers; JdbcDialect.java:305-326 supplies the dialect-side equivalent. JdbcSink.createWriter:199-210 and restoreWriter:276-287 pass the default ORIGINAL getValue() string (original) into CatalogUtils.quoteTableIdentifier, so the enum parse is on the normal path even when users never set field_ide. SQL generation reaches dialect.quoteIdentifier/getFieldIde for columns. The PR fixes both copies rather than only its reported entry. CatalogUtilsTest:60-87 and MysqlDialectTest:115-140 cover mode parsing and actual quoting with tr_TR/az_AZ, restoring the base, FORMAT and DISPLAY locale defaults in finally.

Before:

FieldIdeEnum.valueOf(fieldIde.toUpperCase());
identifier.toLowerCase(); identifier.toUpperCase();

After:

FieldIdeEnum.valueOf(fieldIde.toUpperCase(Locale.ROOT));
identifier.toLowerCase(Locale.ROOT); identifier.toUpperCase(Locale.ROOT);

Key Findings

  • The default JDBC writer creation path reaches CatalogUtils even without an explicit field_ide setting.
  • Dialect SQL identifier conversion is corrected consistently with catalog/table resolution.
  • Only locale-dependent case rules change; explicit modes and quoting delimiters remain stable.
  • The new unit cases are relevant and deterministic, but no existing JDBC IT or user guide is updated.

Complete runtime path

Job config -> JdbcSinkFactory -> JdbcSink.createWriter / restoreWriter
 -> FIELD_IDE default ORIGINAL -> getValue() (original) -> quoteTableIdentifier
 -> CatalogUtils.getFieldIde parses original with Locale.ROOT
 -> catalog lookup/output-format SQL construction -> dialect.quoteIdentifier
 -> JdbcDialect.getFieldIde converts identifier case with Locale.ROOT
 -> driver prepare/bind/write/checkpoint; transaction and reconnect contracts unchanged

The effects depend on the entry and preconditions above. Recovery, batching and connector lifecycle retain their existing contracts unless explicitly described here; source inspection is not runtime proof.

1.2 Compatibility Impact

Partially incompatible. Public APIs, option names/defaults, protocols and checkpoint formats are unchanged. Identifiers deliberately cease following the worker default locale. Existing jobs relying on Turkish/Azeri case conversion may resolve a different physical identifier after upgrading, so bilingual migration guidance is needed (Issue 2). ORIGINAL now avoids an unintended startup error; it does not recase identifiers.

1.3 Performance / Side-Effect Analysis

Three explicit Locale.ROOT arguments add no new buffers, cache, threads, locks, retries or network I/O. String case conversion was already present. Resource ownership, row batching and transaction/recovery semantics are unchanged.

1.4 Error Handling and Logging

The previous locale-induced IllegalArgumentException is removed for valid modes. Invalid field_ide values still follow the existing enum-validation contract; no new exception swallowing or sensitive logging occurs.

Issue 1: Exercise the existing JDBC integration boundary

  • Location: seatunnel-connectors-v2/connector-jdbc/src/test/java/org/apache/seatunnel/connectors/seatunnel/jdbc/catalog/utils/CatalogUtilsTest.java:60
  • Problem description: Both new tests call helpers/dialects directly. They do not construct the real sink with the default field_ide, resolve its table and write/read data under an affected locale. This connector already has JdbcMysqlIT, but no IT is updated.
  • Potential risk: Factory/config/catalog wiring could still select a different normalization path without these helper assertions detecting it. The repository requires updating the existing IT when changing a connector with one.
  • Best improvement / root-cause and location assessment: Extend the existing JDBC IT with the smallest deterministic default-ORIGINAL and explicit-case scenario through real sink construction and persisted values. Set the affected locale in the actual runtime owning identifier resolution, restore it deterministically, and avoid a new parallel test harness. Keep these useful unit tests.
  • Severity: Medium; blocking.
  • Raised by another reviewer: No.

Issue 2: Document the intentional locale-independent identifier behavior

  • Location: docs/en/connectors/sink/Jdbc.md:1
  • Problem description: The patch changes physical identifier conversion for locale-sensitive workers but updates neither language guide nor the incompatible-changes entry. This is broader than merely making enum parsing accept original.
  • Potential risk: An upgraded LOWERCASE/UPPERCASE job that depended on host-local case rules can target a different identifier without an operator migration note.
  • Best improvement / root-cause and location assessment: Add matching en/zh JDBC guidance and a concise incompatible-changes entry: field_ide case rules use Locale.ROOT, ORIGINAL preserves names, and users should verify existing locale-sensitive physical identifiers or use their exact original spelling before upgrading. No new option or default is needed.
  • Severity: Medium; blocking.
  • Raised by another reviewer: No.

2. Code Quality Assessment

2.1 Coding Standards

The complete changed-file set, imports and removed lines were inspected. The two changed helper blocks explain the Turkish/Azeri failure and use the existing enum/quoting contracts. No new core method/field, dependency, SPI or serialization is introduced.

2.2 Test Coverage and Test Stability

Stability rating: Stable. CatalogUtilsTest.java:60-87 and MysqlDialectTest.java:115-140 use fixed inputs and synchronous assertions; finally restores all three locale defaults in the correct order. No ports, timing waits, unordered values or external state are added. The suite uses normal sequential JUnit execution; if parallel same-JVM execution is later enabled, these global-locale mutations need a shared resource lock. This rating does not fill the missing real sink regression in Issue 1.

Local verification results: exact-head git fetch and isolated review branch seatunnel-review-13063 created; full git diff 5598ed7f3a88602032a18b617cb21c688aacf965...3755991a1268e42a0c780c90cd5e0369fa96e629 read (4 files); git diff --check passed; git show, rg and line-numbered source/caller/config/test reads used for the trace above. GitHub changed filenames are reconciled with this local diff before publication. No local compile, Maven verify, unit/IT/E2E, Docker, service or UI execution occurred, as required for this review task. No build/deployment artifact was reused; engine-ui was not built.

2.3 Documentation Updates

Both docs/en and docs/zh require the focused behavior and migration note in Issue 2. Existing option names/defaults stay unchanged.

3. Architectural Soundness

3.1 Elegance of the Solution

Precise fix.

3.2 Maintainability

Best change-location assessment: Both existing identifier-normalization helpers are the correct root-cause boundary. The smallest safe production change already matches the best approach; do not alter JVM defaults, driver behavior or individual catalog names to compensate.

3.3 Extensibility

Keep existing connector identities and contracts. Reuse the current boundary and regression fixtures; no shared-framework redesign or unrelated dependency is needed for the behavior reviewed here.

3.4 Historical-Version Compatibility

Public APIs, option names/defaults, protocols and checkpoint formats are unchanged. Identifiers deliberately cease following the worker default locale. Existing jobs relying on Turkish/Azeri case conversion may resolve a different physical identifier after upgrading, so bilingual migration guidance is needed (Issue 2). ORIGINAL now avoids an unintended startup error; it does not recase identifiers. This review does not claim an executed upgrade/recovery validation.

4. Issue Summary

Number Issue Location Severity
1 Exercise the existing JDBC integration boundary seatunnel-connectors-v2/connector-jdbc/src/test/java/org/apache/seatunnel/connectors/seatunnel/jdbc/catalog/utils/CatalogUtilsTest.java:60 Medium, blocking
2 Document the intentional locale-independent identifier behavior docs/en/connectors/sink/Jdbc.md:1 Medium, blocking

Completeness check: full diff and affected entry/call chain, failure/resource paths, compatibility, tests and stability, bilingual docs, configuration/registration and current CI/merge gates were inspected before enumerating these findings. No additional finding is reserved for a later round on this version.

Community review reconciliation: No other reviewer, inline comment or discussion was present at collection. This is the first complete review on this head.

5. Merge Recommendation

Conclusion: Ready to merge after fixes

  1. Blockers — must be fixed: Issue 1: Exercise the existing JDBC integration boundary; Issue 2: Document the intentional locale-independent identifier behavior; Required current-head CI and effective maintainer review/merge gates must be satisfied.
  2. Recommended fixes — non-blocking: No additional unrelated redesign is requested.

Overall assessment: Both existing identifier-normalization helpers are the correct root-cause boundary. The smallest safe production change already matches the best approach; do not alter JVM defaults, driver behavior or individual catalog names to compensate. Current head 3755991a1268e42a0c780c90cd5e0369fa96e629; base dev at 5598ed7f3a88602032a18b617cb21c688aacf965. Checks: Signal pull request update=QUEUED. Check references: Signal pull request update. Compare: ahead, ahead 1, behind 0; merge state blocked / BLOCKED. Behind/diverged status alone is synchronization metadata and does not justify a sync-and-rerun instruction. Daniel has READ permission: this COMMENT is a technical conclusion, not an effective APPROVED event or dismissal of historical requested changes. A write-capable maintainer owns final approval/dismissal where required. The collected head has a queued PR signal and no completed runtime Build. No failed executed lane or disabled-Actions fact is established. Let the existing signal/fork workflow finish; do not add an empty commit or unrelated patch just to chase a missing aggregate. Thanks again; happy to help with the focused next revision.

@DanielLeens

Copy link
Copy Markdown
Contributor

Thanks again for the contribution. The CI fact cited previously has changed: the queued signal has completed, and the exact-head Build is now failing. The executed edge-agent-it (11, ubuntu-latest) lane fails while running engine-server unit tests: JobMasterTest.before:128 reports Node failed to start! after its 300-second setup window. The Kafka lane also ends with failure, but the returned log ends during JVM diagnostic output without an attributable test assertion, so I am not assigning it a speculative cause. The latest dev changes since the previous audit do not fix these shared startup fixtures; #13028 and #13030 are still open. A simple base sync is not an established cure. Please rerun only the failed jobs and retain startup/runner diagnostics if they repeat; no unrelated locale-normalization patch is requested. The existing JDBC integration-coverage and bilingual-behavior-documentation requests in my complete review remain open independently of CI.

Snapshot 2026-10-30T03:23:54.060709+00:00: head 3755991a1268e42a0c780c90cd5e0369fa96e629; Signal pull request update = SUCCESS; Build = FAILURE.

Base dev; comparison diverged, ahead 1, behind 3; merge state blocked. Behind/diverged alone is recorded metadata and does not add a sync request. This is an unchanged-head discussion/CI clarification, not a new complete source review, an effective approval or a dismissal of historical requested changes.

@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 improving the locale cleanup. I rechecked the new head; the production fix remains sound, but the two earlier delivery gaps are still present.

What Problem Does This PR Solve?

User pain point: JDBC identifier conversion depends on the worker JVM locale. With Turkish/Azerbaijani defaults, even original can fail enum lookup and i/I identifiers can be converted differently between workers.

Fix approach: Use Locale.ROOT for both option-name parsing and identifier case conversion in the catalog utility and dialect boundary.

One-sentence summary and example: Under tr_TR, field_ide=original now selects ORIGINAL reliably; uppercase conversion uses the same identifier spelling as a locale-neutral worker.

1. Code Change Review

1.1 Core Logic Analysis

CatalogUtils.getFieldIde and JdbcDialect.getFieldIde now use Locale.ROOT at all three case-conversion sites. Their existing null/empty handling and ORIGINAL branch remain intact. CatalogUtils feeds table/DDL quoting; dialect implementations such as MysqlDialect and PostgresDialect feed generated DML identifiers. The new revision restores the default, FORMAT and DISPLAY locales in finally.

Before:

FieldIdeEnum.valueOf(fieldIde.toUpperCase());
identifier.toUpperCase();

After:

FieldIdeEnum.valueOf(fieldIde.toUpperCase(Locale.ROOT));
identifier.toUpperCase(Locale.ROOT);

Key Findings

  • Both metadata/DDL and DML helper boundaries are updated consistently.
  • Invalid modes still fail rather than silently selecting a fallback.
  • The test cleanup correction is accepted; it does not cover the real generated-SQL path or supply upgrade guidance.

Complete runtime path

JDBC factory/config -> field_ide -> catalog create/quote path -> CatalogUtils.getFieldIde
JDBC sink writer -> dialect SQL generation -> quoteIdentifier -> JdbcDialect.getFieldIde -> JDBC statement

The root locale removes host-dependent mode lookup and case folding. Existing configurations using ORIGINAL preserve names. Intentional locale-specific uppercase/lowercase output can change, which requires migration guidance.

1.2 Compatibility Impact

Partially incompatible. No option or public API changes. Explicit lower/uppercase behavior under Turkish/Azerbaijani-like locales changes to locale-neutral output and can target different existing physical identifiers. No checkpoint format changes.

1.3 Performance / Side-Effect Analysis

The same number of string conversions remains. No new resources, synchronization or per-row I/O is added.

1.4 Error Handling and Logging

Existing IllegalArgumentException behavior for unsupported modes is preserved. Both new tests restore the modified global locale state in finally, including category defaults.

Issue 1: Exercise the existing JDBC integration boundary

  • Location: seatunnel-connectors-v2/connector-jdbc/src/test/java/org/apache/seatunnel/connectors/seatunnel/jdbc/catalog/utils/CatalogUtilsTest.java:60
  • Problem description: The changed head adds helper assertions and better cleanup but still does not exercise the existing JDBC integration path requested previously.
  • Potential risk: Helper tests alone do not verify that the configured/default field_ide reaches actual generated SQL and the intended database identifiers.
  • Best improvement: Extend an existing JDBC fixture with locale-sensitive names and the relevant field_ide modes; assert exact written/read rows through the production path. Reuse the current fixture and restore all locale defaults.
  • Severity: Medium; blocking.
  • Raised by another reviewer: No

Issue 2: Document the locale-independent identifier transition

  • Location: docs/en/connectors/sink/Jdbc.md:1
  • Problem description: The guides and migration notes still omit that explicit case conversion can select different physical names after this change.
  • Potential risk: An upgrade can fail to find an existing locale-derived table or column.
  • Best improvement: Add matching English/Chinese field_ide guidance and a short incompatible-changes entry. Explain checking physical identifiers and using ORIGINAL when their exact spelling must be preserved.
  • Severity: Medium; blocking.
  • Raised by another reviewer: No

2. Code Quality Assessment

2.1 Coding Standards

The focused comments explain why Locale.ROOT is required. No new public abstraction or dependency is introduced.

2.2 Test Coverage and Test Stability

Test stability: Stable under the current default sequential test execution. The tests use deterministic Turkish/Azerbaijani inputs and now restore default/FORMAT/DISPLAY locales. Locale is JVM-global, so parallelizing these tests in future would require isolation. Current assertions cover helpers only; the existing JDBC integration fixture is still unchanged.

Local analysis: fetched the head, created independent branch seatunnel-review-13063, read the complete 4-file diff and traced affected callers with git show/git grep. No local compilation, unit tests, integration tests, E2E, containers, or job execution was performed, as requested. These are source-analysis conclusions; execution evidence is the current-head CI below.

2.3 Documentation Updates

Neither English nor Chinese JDBC guidance nor incompatible-changes is updated. The previous documentation request remains applicable.

3. Architectural Soundness

3.1 Elegance of the Solution

Precise production fix with incomplete delivery coverage. The two central identifier helpers are the correct layer. Best production fix and smallest production diff coincide; keep the correction here instead of compensating in individual connectors.

3.2 Maintainability

A small existing integration scenario should connect the helper fix to generated SQL and actual identifiers.

3.3 Extensibility

Locale-neutral identifier behavior remains reusable by all dialects without new mode flags.

3.4 Historical-Version Compatibility

Existing ORIGINAL jobs retain exact identifiers. Explicit case conversion on locale-sensitive hosts is a deliberate behavior transition and needs a documented migration decision.

4. Issue Summary

Number Issue Location Severity
1 Exercise the existing JDBC integration boundary seatunnel-connectors-v2/connector-jdbc/src/test/java/org/apache/seatunnel/connectors/seatunnel/jdbc/catalog/utils/CatalogUtilsTest.java:60 Medium
2 Document the locale-independent identifier transition docs/en/connectors/sink/Jdbc.md:1 Medium

5. Merge Recommendation

Conclusion: Ready to merge after fixes

  1. Blockers — must be fixed
    • Issue 1: Exercise the existing JDBC integration boundary; Issue 2: Document the locale-independent identifier transition The two existing coverage/documentation items remain; current-head CI is successful.
  2. Recommended fixes — non-blocking
    • No additional unrelated changes requested.

Overall assessment: Accept the locale cleanup correction. No new production-code blocker was found, but the earlier integration and migration requests have not been addressed.

Existing-review reconciliation: No independent reviewer technical findings or maintainer APPROVED/CHANGES_REQUESTED intent were present in the retrieved reviews and inline discussion. Author replies have been incorporated into this single full review.

Head 7111c99e859615e3025aabbe5ac0035a1807910f. Live base dev at 3ac2d1cec6aa7b3741c4dacdd23020f778e23c02; comparison diverged, ahead 2 / behind 1; merge state BLOCKED. Behind/diverged alone is recorded metadata, not a request to synchronize upstream. Checks: Signal pull request update = SUCCESS; Build = SUCCESS

Current-head Build and Signal checks are SUCCESS; no CI rerun or upstream synchronization is requested solely for branch drift.

Daniel has READ repository permission. This COMMENT records the technical conclusion; it is not an effective maintainer approval or a dismissal of any historical requested-changes entry. A write-capable maintainer owns the final repository approval gate.

@SEPURI-SAI-KRISHNA

Copy link
Copy Markdown
Collaborator Author

@DanielLeens thanks, you are right about Issue 2, and my earlier description was wrong. "uppercase" and "lowercase" contain no i, so their enum lookup never failed on a Turkish or Azerbaijani worker. A job there with one of these modes produced USER_İD or user_ıd, and after this change it produces USER_ID or user_id. So it is a behaviour change for working jobs, not only a startup fix.

Added in the new commit:

  • incompatible-changes.md, en and zh: what changes, that only Turkish or Azerbaijani default locales are affected, and the migration step (rename such tables or columns to the ASCII spelling before upgrading).
  • The field_ide section of the JDBC sink documentation, en and zh: the conversion uses Locale.ROOT, with an example.

Issue 1: I added JdbcSinkTest.createWriterDoesNotDependOnTheDefaultLocale. It builds a real JdbcSink (MySQL dialect, query only, field_ide not set) and calls createWriter under tr-TR and az-AZ. That is the exact path that failed for every such sink. With the CatalogUtils fix reverted it fails with No enum constant ...FieldIdeEnum.ORİGİNAL.

I did not extend JdbcMysqlIT. The failure depends on the default locale of the engine JVM, and the E2E suites run the engine in a container with that container's default locale. Covering it there would mean starting the engine with a Turkish locale for this one case.

Note: the latest head before this commit, 7111c99e8, is a merge of dev done from the GitHub UI, not a change to the locale code.

Checks, JDK 17: JdbcSinkTest, CatalogUtilsTest and MysqlDialectTest 27 tests, 0 failures; spotless:check clean; seatunnel-ci-tools 34 tests, 0 failures. The PR description is updated.

@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.

Thank you for the quick and thorough follow-up, and for correcting the description about uppercase/lowercase. I re-read the whole diff at head b832c23e62ca7ff1e376687bb62ea5dcdb284091. Both delivery gaps from my previous round (real-path coverage and bilingual compatibility guidance) are now resolved. I found no new source blockers. I also apologize that my earlier CI comment was only a pointer; the details are in the CI note below.

What Problem Does This PR Solve?

User pain point: On a worker whose default locale is Turkish or Azerbaijani, "original".toUpperCase() becomes ORİGİNAL, which is not a FieldIdeEnum constant. Every JDBC sink without field_ide (or with ORIGINAL) then fails at writer creation, and UPPERCASE/LOWERCASE produce dotted/dotless İ/ı identifiers.

Fix approach: Use Locale.ROOT for the enum lookup and the identifier case conversion in both CatalogUtils.getFieldIde and JdbcDialect.getFieldIde.

Summary: Under tr-TR, field_ide=original starts again and uppercase yields USER_ID exactly as on every other worker.

1. Code Change Review

1.1 Core Logic

Runtime path:

JdbcSink.createWriter / restoreWriter -> CatalogUtils.quoteTableIdentifier(table, "original")
  -> CatalogUtils.getFieldIde  (enum lookup + identifier case)       CatalogUtils.java:~63-77
JdbcSinkWriter SQL generation -> dialect.quoteIdentifier
  -> JdbcDialect.getFieldIde                                         JdbcDialect.java:~307-320
  • The change is exactly five call sites switched to Locale.ROOT; null/blank handling, the ORIGINAL branch and the invalid-value failure behavior are unchanged.
  • The default ORIGINAL value is parsed on the normal path of every sink, so the failure was not an edge case.
  • I checked that the two helpers are the only places in this flow parsing field_ide; the fix is placed at the right boundary.

1.2 Compatibility

Partially incompatible, and now properly documented. Only workers with a Turkish/Azerbaijani default locale and an explicit UPPERCASE/LOWERCASE are affected (names containing i/I switch from İ/ı to ASCII). No option, default, API, or checkpoint/state format changes. The migration note in incompatible-changes.md (en and zh) is accurate.

1.3 Performance / Side Effects

Same number of string conversions; no new resources or threads.

1.4 Error Handling / Logging

Invalid field_ide values still throw IllegalArgumentException; nothing is swallowed. No new logging.

No code issues found.

2. Code Quality

2.1 Standards / Comments

Clean, minimal, with a useful why-comment at both sites. No wildcard imports.

2.2 Tests - Stability: Stable

Three tests, each covering a distinct real entry (CatalogUtils.quoteTableIdentifier, MysqlDialect.quoteIdentifier, real JdbcSink.createWriter) under tr-TR and az-AZ. Locale state (base, FORMAT, DISPLAY) is restored in finally, and the mutation results in the description show they fail on the old code. No Thread.sleep, no external services. Skipping the E2E is reasonable since the locale belongs to the engine JVM. Minor note (non-blocking): the three tests repeat the same save/restore block; fine for now.

2.3 Docs

Jdbc.md (en/zh) and incompatible-changes.md (en/zh) are updated and consistent with the code.

3. Architectural Soundness

This is the precise fix at the right layer, consistent with the earlier merged locale fixes (#12996, #12495, #12618, #12582). It is easy to maintain and introduces no new API. History compatibility is covered by the documented migration step. (Other toLowerCase()/toUpperCase() calls elsewhere in the module are out of scope here.)

4. Issue Summary

# Severity Location Issue Blocking
- - - No source issues found -
CI Info Build on head Still pending at review time CI only

CI note: At review time, Build on b832c23 is pending and Signal pull request update passed; merge state is BLOCKED (awaiting required checks/approval). My previous comment reported failures (JobMasterTest.before:128 "Node failed to start!" in edge-agent-it) on the earlier head; those are shared engine-server startup flakes unrelated to a JDBC Locale.ROOT change. If they repeat, please rerun only the failed jobs.

5. Merge Recommendation

Conclusion: Ready to merge after fixes

Blockers: none in source. Only the pending/previously flaky CI must finish green on this head.

Recommended non-blocking: none required.

Overall: a small, correct, well-tested and well-documented fix. Thanks again for the careful iteration!

sharpca added a commit to sharpca/seatunnel that referenced this pull request Nov 1, 2026
The JDBC dialect type converters convert the source type name with
String#toUpperCase() / String#toLowerCase() without a locale before
matching it against the dialect type constants. Under a Turkish or
Azerbaijani default locale a lower-case "integer" upper-cases to
"INTEGER" with a dotted capital I and an upper-case "INT4" lower-cases to
"int4" with a dotless i, so the type no longer matches any constant and
the converter falls through to its unsupported-type branch.

Pass Locale.ROOT to every remaining case conversion in connector-jdbc so
that the same source type maps to the same SeaTunnel type on any worker.
The MySQL, OceanBase and SQL Server converters, JdbcDialect and
CatalogUtils are already covered by apache#13063, apache#13076 and apache#13077 and are not
touched here.

@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 again for the careful follow-up. The CI fact in my October 31 review has changed: the previously pending Build is now successful on the unchanged head b832c23e62ca7ff1e376687bb62ea5dcdb284091.

That review explicitly closed both earlier source-side requirements (real writer-path coverage and bilingual compatibility guidance), leaving CI as the only technical blocker. CI has now passed, so I am submitting an approval on that basis. No new source finding or contributor revision is being requested.

I checked the exact-head fork Build, its executed job results, and the Apache Build aggregate. The JDK 11/17 unit-test jobs, code style and the executed updated-module integration jobs succeeded. Dedicated JDBC IT lanes were skipped by selection; the accepted writer-path regression is in JdbcSinkTest, covered by the unit suite. I have not executed tests locally.

My account has READ repository permission. This approval records Daniel's technical conclusion; it does not claim to satisfy write-reviewer branch protection, dismiss another review or merge the PR. A maintainer with write access must reconcile any remaining effective approval/merge gate. The branch comparison is recorded separately; divergence without an unrelated failed CI signal does not request a sync or rerun.

…ocale

# Conflicts:
#	docs/en/introduction/concepts/incompatible-changes.md
#	docs/zh/introduction/concepts/incompatible-changes.md

@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 e265bda0: the only change since my last review (b832c23e) is a merge of the latest dev; the PR's own diff (9 files: JDBC field_ide locale fix, tests and en/zh docs) is unchanged.

The apache-side Build is SUCCESS on this head (fork run 42398404365). My previous approval had no source blocker, so it stands on the new head. I have not run tests locally.

Conclusion: Ready to merge

Blockers: None

davidzollo
davidzollo previously approved these changes Nov 9, 2026

@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
Good job

@davidzollo
davidzollo added this pull request to the merge queue Nov 9, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to a conflict with the base branch Nov 9, 2026
# Conflicts:
#	docs/en/introduction/concepts/incompatible-changes.md
#	docs/zh/introduction/concepts/incompatible-changes.md

@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 3b9127a4: the only change since my last review (e265bda0) is a merge of the latest dev (535d4237); the PR's own diff (9 files: JDBC field_ide locale fix, tests and en/zh docs) is unchanged. The merge touched incompatible-changes.md (en/zh) only to bring in other dev entries; your field_ide entry is intact and no conflict text is left.

CI: green on this exact head. The apache-side Build is SUCCESS (fork run 42656160845). The branch is up to date with dev.

My previous approval had no source blocker, and I agree with @davidzollo's +1. I have not run tests locally.

Conclusion: Ready to merge

Blockers: None

@SEPURI-SAI-KRISHNA

Copy link
Copy Markdown
Collaborator Author

@davidzollo #13061 merged first and added its section at the same place in incompatible-changes.md, so this PR left the merge queue with a conflict. I merged dev and kept both sections, with no other change. The push dismissed your approval. Could you approve it again and add it back to the queue?

@DanielLeens

Copy link
Copy Markdown
Contributor

Thanks for the clarification. My technical approval already covers the current head after the documentation conflict resolution, and the current checks remain green. The request to restore a dismissed maintainer approval and re-enter the merge queue needs that maintainer; I will not act through another account. No additional source change is requested from Daniel.

This is a discussion reply on unchanged head 3b9127a40551eb450715c11dd97c9bb955f8c470, not another complete source review. Daniel has READ repository permission; effective maintainer approval/dismissal remains separate. No local tests were run.

@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
Good job

@DanielLeens

Copy link
Copy Markdown
Contributor

Thanks @davidzollo for the review. My technical conclusion on this unchanged head remains clear, and both the Apache and exact-head fork Builds are successful. The remaining approval/merge-queue action belongs to a write-capable maintainer. No additional source change is requested from Daniel.

@davidzollo

Copy link
Copy Markdown
Contributor

+1

Thanks for your contribution! You are welcome to join the #contributors channel in the Apache SeaTunnel Slack workspace for technical discussions and collaboration: https://s.apache.org/seatunnel-slack

@DanielLeens

Copy link
Copy Markdown
Contributor

Thanks for the encouragement and the additional +1! My existing source-clear conclusion stands on the unchanged head, and the current Build is successful. The remaining step is effective maintainer review; I do not need another code update from the contributor for my earlier points.

Checked unchanged head 3b9127a40551eb450715c11dd97c9bb955f8c470 against dev: compare diverged, ahead 5 / behind 61. This drift is recorded independently; it does not by itself request synchronization. This is a discussion/CI follow-up, not another full source review. No local build, test or runtime execution was performed. Daniel has READ repository permission; effective maintainer approval/dismissal remains a separate repository gate. Checked 2026-11-21T12:06:29.365986+00:00.

@SEPURI-SAI-KRISHNA

Copy link
Copy Markdown
Collaborator Author

Hi @davidzollo, thank you very much for the review and the +1.

I noticed this PR has not entered the merge queue yet, although it is approved and the Build is green. I may be wrong, but it looks like auto-merge was set with the "merge" method, while dev only accepts squash through the merge queue. #13093 and #12859 seem to be in the same state, in case that helps.

Whenever you have a moment, could you please add it to the merge queue? No rush at all, and thanks again for your time!

@DanielLeens

Copy link
Copy Markdown
Contributor

Thanks for checking the merge-queue state. The current API snapshot confirms APPROVED reviewDecision and successful Apache/exact-head fork Build 42656160845, while mergeStateStatus remains BLOCKED.

A write-capable maintainer needs to handle enqueueing or the repository's remaining merge gate. Those fields alone do not prove that the auto-merge method is the cause, so I do not want to turn that hypothesis into a confirmed diagnosis. Daniel has READ permission; I have not changed the queue or merge settings. My current-head technical approval remains unchanged, and no source change or rebase is requested for this follow-up.

This is a discussion/CI follow-up on unchanged head 3b9127a40551eb450715c11dd97c9bb955f8c470, not a fresh full source review. No local build, test or SeaTunnel runtime execution was performed.

This branch has not been deployed

No deployments
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.

[Bug][Connector-V2][JDBC] JDBC sink fails to create its writer under a Turkish or Azerbaijani locale

4 participants