Repository navigation
Conversation
…he default locale Several seatunnel-api code paths matched an identifier or a type name with String#toUpperCase()/toLowerCase() without Locale.ROOT, so the result depended on the JVM default locale of the worker. Under a Turkish or Azerbaijani locale an upper-case "I" lower-cases to a dotless "ı" and a lower-case "i" upper-cases to a dotted "İ", so a name that contains an "i" or an "I" no longer matched the constant it was compared against. PluginIdentifier#hashCode could then return a different value for two identifiers that equals considers equal, and a job that enables the metalake failed to start with "No enum constant org.apache.seatunnel.common.constants.MetaLakeType.GRAVİTİNO". Use Locale.ROOT in PluginIdentifier, MetalakeConfigUtils, MetaLakeFactory and GravitinoTableSchemaConvertor, and add a regression test to each of them. Fixes apache#13169 Signed-off-by: sharpca <110613026+sharpca@users.noreply.github.com>
|
CI status on
The change is limited to |
|
Both fork runs on this head are green now:
The apache-side https://github.com/apache/seatunnel/actions/runs/42390733170 Approving that run would let the privileged Nothing is pending on the author side. |
|
The Status on Nothing is pending on the author side. The change is limited to |
DanielLeens
left a comment
There was a problem hiding this comment.
Thanks a lot for this fix, @sharpca. The description is very clear, the regression tests were checked against the unpatched sources, and the scope is nicely tight. I went through the full diff on 0604e39ba and the real call chain in dev.
What Problem Does This PR Solve?
Several seatunnel-api paths fold identifiers or type names with toUpperCase() / toLowerCase() using the JVM default locale. Under tr/az, I folds to dotless ı and i to dotted İ, so:
PluginIdentifier#hashCodedisagreed with its locale-independentequals(StringUtils.equalsIgnoreCase), breaking theequals/hashCodecontract for names containingI/i(for exampleIceberg).MetalakeConfigUtilsturnedgravitinointoGRAVİTİNO, soMetaLakeType.valueOfthrew and a metalake-enabled job could not start.MetaLakeFactoryregistry keys and lookup keys diverged.GravitinoTableSchemaConvertorcould not match type names such asINTEGER.
Fixes #13169.
1. Code Change Review
1.1 Core logic
Every changed call site now passes Locale.ROOT, which is exactly what the comparisons intend (ASCII identifiers / type keywords):
seatunnel-api/src/main/java/org/apache/seatunnel/api/common/PluginIdentifier.java:74-80-hashCode()now folds withLocale.ROOT, so it is consistent withequals()for every ASCII name.seatunnel-api/src/main/java/org/apache/seatunnel/api/metalake/MetaLakeFactory.java:42-58- register and lookup use the same root-locale key.seatunnel-api/src/main/java/org/apache/seatunnel/api/metalake/MetalakeConfigUtils.java:58-75-MetaLakeType.valueOf(metalakeType.toUpperCase(Locale.ROOT)).seatunnel-api/src/main/java/org/apache/seatunnel/api/metalake/gravitino/GravitinoTableSchemaConvertor.java:206, 274, 350- complex type, simple type and length/scale matching.
Runtime path (verified in dev):
Zeta MultipleTableJobConfigParser / Flink & Spark Task*Command / Conf*ValidateCommand
-> MetalakeConfigUtils.getMetalakeConfig(jobConfig) [only when metalake_enabled]
-> MetaLakeType.valueOf(type.toUpperCase(Locale.ROOT)) (was: GRAVİTİNO -> IllegalArgumentException)
-> MetaLakeFactory.createClient(...) -> CLIENT_REGISTRY.get(root-lower key)
-> GravitinoTableSchemaConvertor.convertor(...) per column type
Plugin discovery / any HashMap/HashSet<PluginIdentifier>
-> PluginIdentifier.hashCode() now agrees with equalsIgnoreCase
The normal path is hit only on a JVM whose default locale is tr/az; on every other locale the folded strings are byte-identical to before, so behavior is unchanged there.
1.2 Compatibility
- No public API signature, option name, default value or serialized format changes.
PluginIdentifier#hashCodevalues change only ontr/azJVMs, and the hash code is not persisted anywhere (it is only used for in-memory hash collections), so there is no checkpoint/savepoint or wire impact.- The env-var name lookups (
METALAKE_ENABLED,METALAKE_TYPE,METALAKE_URL) contain noi, so that part is a consistency change with no behavioral effect.
1.3 Side effects
None observed: no extra allocations on a hot path beyond what the old code already did, no new dependency, no new configuration.
1.4 Error handling / logging
Unchanged; the existing IllegalArgumentException messages are kept.
2. Code Quality
2.1 Standards
Style is consistent with existing Locale.ROOT usage in ConfigUtil.convertToEnum. ASF headers are present on the new test files.
2.2 Tests
PluginIdentifierTest#testHashCodeIsIndependentOfDefaultLocale- fails on the old code (hash mismatch forIceberg/iceberg). Stable.MetalakeLocaleTest- both cases throw on the old code. Stable. TheassertNotNullchecks are weak on their own, but the failure mode being guarded is an exception, so the tests still go red on a regression.GravitinoTableSchemaConvertorTest#testConvertTypeIsIndependentOfDefaultLocale- exact type assertion (BasicType.INT_TYPE). Stable.- Locale is restored in
finally, andseatunnel-apihas nojunit-platform.propertiesenabling parallel execution, so the default-locale mutation cannot leak into concurrent tests. Stability: Stable.
2.3 Docs
The incompatible-changes.md entries are present in both docs/en and docs/zh, and the content matches.
3. Architecture
Doing the fix at each folding site is the right granularity: the comparisons are local and there is no shared helper whose semantics would need to change. The remaining locale-less folds in seatunnel-api are either covered by #13074 (SeaTunnelDataTypeConvertorUtil, VectorIndex) or symmetric within one JVM (DataTypeConvertorFactory registers and looks up with the same fold; ConfigUtil.convertToBoolean only matches TRUE/FALSE, which have no i), so I agree the scope is complete for this issue.
Overlap note for maintainers: draft #13187 (opened later, on 2026-11-08) changes exactly the same four main classes (PluginIdentifier, MetaLakeFactory, MetalakeConfigUtils, GravitinoTableSchemaConvertor) for the same root cause. Since this PR was opened first and also carries the docs entries, it would be good to converge on one of the two so the work is not duplicated.
4. Issue Table
| # | Location | Problem | Severity |
|---|---|---|---|
| 1 | seatunnel-api/src/test/java/org/apache/seatunnel/api/metalake/gravitino/GravitinoTableSchemaConvertorTest.java:972-974 |
The comment says a lower-case i is upper-cased to a dotted I, but the case this test covers (INTEGER) is an upper-case I lower-cased to a dotless ı. Rewording it would help future readers. |
Nit, non-blocking |
| 2 | seatunnel-api/src/test/java/org/apache/seatunnel/api/metalake/MetalakeLocaleTest.java:64 |
Optional: assert something concrete about the returned config (for example that the env block is still there) instead of only assertNotNull. |
Nit, non-blocking |
No other reviewer has raised findings yet.
5. Merge Recommendation
Ready to merge. There are no blockers. CI is green on 0604e39ba (Build: pass), and the PR is one commit behind dev with no conflicts. The two items above are optional polish. Thank you again for the careful work!
Address the two optional nits raised on apache#13170: - GravitinoTableSchemaConvertorTest: the covered case is an upper-case I lower-cased to a dotless i (U+0131), not a lower-case i upper-cased to a dotted I, so the comment was pointing in the wrong direction. - MetalakeLocaleTest: assert the content of the returned env block instead of only asserting that the returned config is not null.
DanielLeens
left a comment
There was a problem hiding this comment.
Thanks a lot for the quick follow-up, @sharpca! I re-reviewed the current head 31f57240b in full (the whole PR diff against dev, plus the delta 0604e39ba..31f57240b).
What Problem Does This PR Solve?
Several seatunnel-api paths folded identifiers and type names with the JVM default locale. Under tr/az, I/i fold to ı/İ, which broke the PluginIdentifier equals/hashCode contract, made MetaLakeType.valueOf throw for gravitino, desynchronized the MetaLakeFactory registry keys, and stopped GravitinoTableSchemaConvertor from matching names such as INTEGER. Fixes #13169.
What changed since my last review (0604e39ba)
The new commit only touches tests, and it addresses both optional nits from my previous review:
seatunnel-api/src/test/java/org/apache/seatunnel/api/metalake/gravitino/GravitinoTableSchemaConvertorTest.java:972-974- the comment now correctly describes the upper-caseI-> dotlessıcase thatINTEGERexercises. Fixed.seatunnel-api/src/test/java/org/apache/seatunnel/api/metalake/MetalakeLocaleTest.java:66-75- the test now asserts theenvblock values (metalake_enabled,metalake_type,metalake_url) instead of onlyassertNotNull. Fixed. The imports (EnvCommonOptions,Constants.ENV) resolve to existing symbols inseatunnel-api/seatunnel-common.
No production code changed in this commit, so my earlier analysis of the main classes still holds:
Zeta MultipleTableJobConfigParser / Flink & Spark starters
-> MetalakeConfigUtils.getMetalakeConfig(jobConfig) [only when metalake_enabled]
-> MetaLakeType.valueOf(type.toUpperCase(Locale.ROOT))
-> MetaLakeFactory.createClient(...) -> registry lookup with the same root-locale key
-> GravitinoTableSchemaConvertor per column type
Any HashMap/HashSet<PluginIdentifier>
-> PluginIdentifier.hashCode() now agrees with equalsIgnoreCase
On non-tr/az locales the folded strings are byte-identical to before, so behavior is unchanged; no option, default, API signature or serialized format changes. Tests remain stable (locale restored in finally, no parallel JUnit execution in seatunnel-api). Docs entries are present in both docs/en and docs/zh.
Overlap with other PRs
- #13187 (draft, opened later) changes the same four main classes for the same root cause. This PR was first and also carries the docs entries, so maintainers may want to converge on one of them to avoid duplicated work.
- #13063 (JDBC
field_idelocale) touchesJdbcDialect/CatalogUtilsin the JDBC connector, so there is no file overlap with this PR.
Issues
| # | Location | Problem | Severity |
|---|---|---|---|
| 1 | docs/en/introduction/concepts/incompatible-changes.md:8, docs/zh/introduction/concepts/incompatible-changes.md |
The PR currently has merge conflicts with dev. #13061 (Lance BIGINT as int64) was merged and added its entry at the same spot, right under ## dev, in both docs files. Resolving it is just keeping both entries. |
Blocker (merge conflict) |
Best improvement: please sync the latest dev and resolve the conflict by keeping both the Lance entry and your API locale entry in both docs/en and docs/zh.
CI
The fork Build run on this head (42624783515) has 80 successful jobs, including Code style, License header and all four unit-test jobs (JDK 11/17, Ubuntu/Windows). The 4 red jobs are not related to this change:
connector-file-sftp-it(JDK 11 and 17): theatmoz/sftp:alpine-3.7Docker image no longer exists (manifest unknown), which currently breaksSftpFileITon every PR.all-connectors-it-5: a Hive metastoreTTransportExceptionduring save-mode handling, an environment issue in a file/Hive connector IT.Dependency licenses: a 40-minute job timeout.
The apache-side PR signal run for this head (42624794011) is waiting for approval, so gh pr checks reports no checks yet. After you sync dev and push, a fresh run will start anyway; please re-run any of the failed jobs above if they hit the same environmental errors.
Merge Recommendation
Ready to merge after fixes. The code and tests look good, and both earlier nits are addressed. The only blocker is the merge conflict in the two incompatible-changes.md files. After that, I will approve again once CI is green on the new head. Thank you again for the careful work!
Sync with the latest dev (apache#13061 merged the Lance BIGINT incompatible-change entry right under '## dev'). Resolve the conflict in docs/en and docs/zh by keeping both the Lance entry and the API locale entry.
|
Hi @DanielLeens, thanks for the re-review. The merge conflict is resolved and Conflict resolution — merge of
Local verification (JDK 11, Maven 3.9.9):
CI on this head: the fork The three red jobs are the same environmental ones you saw on the previous head — The apache-side Thanks again! |
|
Update on the re-run (attempt 2 of the same run): The image is referenced by The remaining jobs of the re-run ( |
DanielLeens
left a comment
There was a problem hiding this comment.
Hi @sharpca, thanks for resolving the conflict so quickly, and for the detailed CI notes.
Re-checked the new head 89e3aa1e: the only change since my last review (31f57240) is a merge of the latest dev (535d4237). The PR's own diff is unchanged: the same 9 files with identical added and removed lines. The conflict in docs/en/introduction/concepts/incompatible-changes.md and docs/zh/introduction/concepts/incompatible-changes.md is resolved correctly. Both the API locale entry and the Lance BIGINT entry from #13061 are kept under ## dev, no conflict markers are left, and GitHub now reports the PR as mergeable.
Previous review points
- Issue 1 (merge conflict with
dev): Fixed in89e3aa1e. - Both earlier test nits are still fixed. No production code changed.
CI (fork run https://github.com/sharpca/seatunnel/actions/runs/42736298199, attempt 4 still running; the apache-side PR signal run for this head is waiting for workflow approval)
unit-test (11, ubuntu-latest)failed with one error:JobStateCleanupDelayTesthitIllegalStateException: Node failed to start!inAbstractSeaTunnelServerTest.beforeafter the 300s Hazelcast startup wait. This is the known environmental Hazelcast startup flake inseatunnel-engine-server. This PR does not touch the engine, and the other 712 tests in that job plus the other three unit-test jobs passed.connector-file-sftp-itwill keep failing on this head for the reason you already found (atmoz/sftp:alpine-3.7is gone). #13203 has now been merged todevand switches it toatmoz/sftp:alpine. Your merge tookdevat535d4237, two commits before that fix, so you don't need a separate PR.
Suggested next step: merge the latest dev once more (2 commits, including #13203). That picks up the SFTP fix and starts a fresh run, which also re-runs the flaky unit-test job.
Conclusion: Ready to merge
- Blockers (non-CI): None. The only previous blocker, the merge conflict, is resolved.
- I'll approve again once
Buildis green on the head that includes #13203.
Thanks again for the careful work!
Pick up apache#13203, which switches the SFTP E2E image to atmoz/sftp:alpine after the alpine-3.7 tag was removed from Docker Hub. This clears the two connector-file-sftp-it failures on this head.
|
Hi @DanielLeens, done — I merged the latest
No separate PR for the SFTP image is needed — thanks for pointing me to #13203. Thanks again! |
|
Hi @DanielLeens, the Build on this head is green now.
The apache-side Thanks! |
DanielLeens
left a comment
There was a problem hiding this comment.
Hi @sharpca, thank you for both updates and for driving CI all the way to green. I checked what you reported and it matches: the new head 7235d6a3 is a merge of dev at 37929219, so it includes #13203, and the fork Build run 42802276450 finished with success on attempt 4 (85 jobs passed, 11 skipped, none failed or cancelled). Your note on connector-file-local-it is also right: a cancelled there means the job hit its 120-minute budget, not a test failure, and both JDK variants passed on the final attempt.
Re-checked the new head 7235d6a3: the only change since my last review (89e3aa1e) is a merge of the latest dev; the PR's own diff is unchanged (the same 9 files with identical patches), and the merge did not touch any PR file.
Previous review points
- Issue 1 (merge conflict with
dev): still fixed. - Both earlier test nits remain fixed. No production code changed since my approval of the original change.
CI
- Fork
Build: green on this head, includingconnector-file-sftp-it(11 and 17), all four unit-test jobs, code style and license checks. - The Apache-side
PR signalrun (https://github.com/apache/seatunnel/actions/runs/42802286511) isaction_required, which only needs a maintainer to approve the workflow; it is not a test result.
Conclusion: Ready to merge
Blockers
- None.
Thanks again for the careful, locale-safe fix!
|
Hi @DanielLeens, thank you — glad we could get it to green, and thanks for the three careful reviews along the way. Nothing is pending on my side for this PR. The only remaining step is the apache-side One unrelated follow-up worth mentioning, since it keeps interfering with PRs: Thanks again! |
DanielLeens
left a comment
There was a problem hiding this comment.
Thanks @sharpca. The timeout follow-up is now tracked in #13219, which I reviewed separately. Keeping that workflow change in its own PR is appropriate. Its current build skipped the affected file-local IT lane, so the longer budget itself has not been exercised by that run.
The CI fact cited previously has changed. On unchanged head 7235d6a326fbbcfac8e8fc07187fe34210b3ddbe, fork Build 42802276450 completed successfully, and the Apache Build check is now green. My earlier pending/missing-workflow guidance is obsolete. My previous conclusion had no remaining source-side blocker. CI was previously the only remaining blocker from my side; CI is now passing, so the conclusion is being changed to approve.
5. Merge Recommendation
Conclusion: Ready to merge
- Blockers — must be fixed: None from my existing source review or current CI. Effective maintainer review remains required; other reviewers retain control of their own outstanding review records.
- Recommended fixes — non-blocking: Earlier optional suggestions remain optional. No unrelated source change is requested to chase CI.
Comparison with dev: diverged, ahead 4 / behind 11; no conflict was reported in the comparison snapshot. Behind is metadata, not a sync request. This is a discussion and CI-gate update on an already-reviewed head, not another full source review. No local build or job was executed. Daniel has READ permission: this technical approval does not substitute for a write-capable maintainer's approval/dismissal or merge action.
|
Hi @DanielLeens, thanks for the approval and for updating the CI gate. Understood on the permission boundary: your approval is the technical sign-off, and the remaining step is the write-capable maintainer's approval/merge. I will not sync Nothing else is pending on the author side for this PR. Thanks again! |
|
Thanks for confirming the reviewed head. The Build for |
DanielLeens
left a comment
There was a problem hiding this comment.
A merge-gate correction for unchanged 7235d6a326fbbcfac8e8fc07187fe34210b3ddbe: GitHub now reports actual content conflicts with current dev (compare diverged, ahead 4, behind 44). The earlier statement that there was no conflict / only approval remained no longer describes the branch. Please resolve the conflicts with current dev and link checks for the resulting head. The existing source-clear assessment and successful old-head CI are preserved; neither makes the conflicted branch mergeable. This is a gate clarification, not a new numbered source review. Daniel has READ permission; effective maintainer approval remains separate. No local tests were run.
|
Hi @sharpca, thanks for the patience on this one, and for confirming the reviewed head. The merge gate has changed since your last comment. On the unchanged head The existing source review found no blockers, and that assessment still holds. The successful Build run 42802276450 only covers the old head, so it won't carry over to the resolved one. Remaining asks:
The Once the resolved head is up and its checks are linked, the remaining step is the maintainer approval and merge. |
|
Thanks @SEZ9, agreed. The unchanged head remains source-clear from my previous full review, but the current comparison still reports actual content conflicts with dev. The author needs to resolve those conflicts and run checks for the resulting head before effective maintainer approval. The separate file-local timeout follow-up stays outside this PR. No new source finding is being added on this unchanged head. |
Purpose of this pull request
Yes, I am contributing this fix to Apache SeaTunnel.
This pull request fixes #13169.
Several
seatunnel-apicode paths match an identifier or a type name withString#toUpperCase()/String#toLowerCase()withoutLocale.ROOT, so the result depends on the JVM default locale of the worker.In a Turkish or Azerbaijani locale an upper-case
Ilower-cases to the dotlessıand a lower-caseiupper-cases to the dottedİ, so a name that contains anior anIno longer matches the constant it was compared against.tr-TRorg.apache.seatunnel.api.common.PluginIdentifierhashCode()lower-cases the engine type, the plugin type and the plugin nameequals()compares withStringUtils.equalsIgnoreCase, which is locale independent, so two equal identifiers got different hash codes and aHashMaplookup could missorg.apache.seatunnel.api.metalake.MetalakeConfigUtilsMetaLakeType.valueOf(metalakeType.toUpperCase())gravitinobecameGRAVİTİNO, which is not aMetaLakeTypeconstantorg.apache.seatunnel.api.metalake.MetaLakeFactorygravitinowhile the lookup key wasgravıtıno, so the lookup failed withUnknown MetalakeClient type: gravıtınoorg.apache.seatunnel.api.metalake.gravitino.GravitinoTableSchemaConvertorI, for exampleINTEGER, was lower-cased toıntegerand no longer matched, so the column type was not convertedAll of these conversions now use
Locale.ROOT.The metalake path is not dead code:
MetalakeConfigUtils.getMetalakeConfigis called by the Flink and Spark starters and by the Zeta job config parser, so a job that enables the metalake failed to start on such a worker.This is disjoint from the other locale pull requests: #13074 covers
SeaTunnelDataTypeConvertorUtilandVectorIndex, #13063 coversJdbcDialectandCatalogUtils, and #12269 covers the plugin discovery.Does this PR introduce any user-facing change?
Yes, in one way:
No enum constant org.apache.seatunnel.common.constants.MetaLakeType.GRAVİTİNO, and the metalake column types are now converted.Nothing else changes for the default locale or for the configuration. The change is documented in
docs/en/introduction/concepts/incompatible-changes.mdanddocs/zh/introduction/concepts/incompatible-changes.md.How was this patch tested?
Three unit tests were added:
PluginIdentifierTest#testHashCodeIsIndependentOfDefaultLocalebuilds two identifiers that are equal ignoring case and asserts that their hash codes are equal under a Turkish default locale.MetalakeLocaleTestresolves the metalake type, and the metalake client and mapper registries, under a Turkish default locale.GravitinoTableSchemaConvertorTest#testConvertTypeIsIndependentOfDefaultLocaleconverts a column of typeINTEGERunder a Turkish default locale.Each test switches the default locale to
tr-TRand restores it in afinallyblock, so the locale cannot leak into the other tests that share the JVM.Result: 59 tests, 0 failures.
spotless:checkpasses.The new tests were also run against the unpatched sources to confirm that they fail there:
PluginIdentifierTest: the two identifiers are equal but their hash codes differ (expected: <-1353815929> but was: <1534074303>).MetalakeLocaleTest: the metalake type lookup fails withIllegalArgumentException: No enum constant org.apache.seatunnel.common.constants.MetaLakeType.GRAVİTİNO, and the mapper registry lookup fails withIllegalArgumentException: Unknown MetalakeClient type: gravıtıno.GravitinoTableSchemaConvertorTest: theINTEGERcolumn is not converted.Check list
New License Guide
incompatible-changes.mdto describe the incompatibility caused by this PR.