Repository navigation
[Fix][API] Parse the schema option independently of the default locale - #13074
SEPURI-SAI-KRISHNA wants to merge 1 commit into
Conversation
DanielLeens
left a comment
There was a problem hiding this comment.
Thanks for the contribution! I reviewed the complete four-file diff and the schema/config callers at 922dad23444c71db2c6841871e788851bcce02fd. No blocking source issue was found.
What Problem Does This PR Solve?
User pain point: lowercase schema tokens such as string, int, timestamp, ivf_flat and cosine can fail under Turkish/Azerbaijani JVM defaults because locale uppercasing produces dotted I rather than the enum's ASCII spelling.
Fix approach: use Locale.ROOT for type-token dispatch, legacy aliases, complex-type detection, decimal map-key splitting and vector index/metric enums.
One-sentence summary and example: schema.fields { id = int } and an IVF_FLAT/COSINE vector constraint now parse identically across default locales, instead of rejecting valid configuration before a job starts.
1. Code Change Review
1.1 Core Logic Analysis
The production changes are seatunnel-api/.../table/catalog/SeaTunnelDataTypeConvertorUtil.java:50,117,130,196 and VectorIndex.java:93,109 (source root src/main/java/org/apache/seatunnel/api/).
Before/after:
// before
SqlType.valueOf(compatible.toUpperCase().replace(" ", ""));
return valueOf(name.toUpperCase());
// after
SqlType.valueOf(compatible.toUpperCase(Locale.ROOT).replace(" ", ""));
return valueOf(name.toUpperCase(Locale.ROOT));Complete affected chain:
connector job schema/config preparation
-> ReadonlyConfigParser.parse
-> FieldParser (:85-101) or ColumnParser (:121-149)
-> deserializeSeaTunnelDataType(field, original declaration)
-> compatibleTypeDeclare -> simple SqlType dispatch
-> on complex syntax: original declaration passed to MAP/ARRAY/DECIMAL/ROW parser
-> recursive key/value/element/ROW field parsing
-> PhysicalColumn -> TableSchema -> CatalogTable -> source/transform/sink schema
-> ConstraintKeyParser.parseConstraintKeyColumn (:235-248)
-> new VectorIndex -> parseIndexType/parseMetricType
-> IndexType.of / MetricType.of -> enum
Key findings:
- Normal configuration preparation reaches both paths, before task deployment.
- ROOT only normalizes machine tokens. Original nested ROW declarations/field names are passed to the existing parsers, so identifiers are not uppercased into the produced schema.
- Recursive MAP/ARRAY handling retains its existing boundaries and decimal comma handling.
- This is a precise normalization fix. It does not claim to fix unrelated pre-existing grammar or array-class limitations.
1.2 Compatibility Impact
Fully compatible with the intended case-insensitive schema grammar. Public signatures, options/defaults, enum values, serialVersionUID/state layouts and network protocols remain unchanged. Existing LONG/SHORT/BYTE aliases stay supported. Previously locale-rejected valid tokens are accepted; no migration is needed.
1.3 Performance / Side-Effect Analysis
The same strings are normalized at preparation time; no extra row-time CPU/allocation, GC pressure, network, lock, thread, queue or mutable production state is introduced. Retry, checkpoint, idempotence and resource release are unaffected. ROOT avoids relying on global JVM mutation in production.
1.4 Error Handling and Logging
Simple-token IllegalArgumentException still falls through to complex parsing; unsupported syntax retains the existing contextual error. Vector parse errors still name the column/valid values, and ReadonlyConfigParser wraps them with the constraint location. No new swallow branch, success misreport or credential logging is introduced.
No blocking source issues found. There are no formal numbered findings on this head.
2. Code Quality Assessment
2.1 Coding Standards
Minimal imports/normalization changes match the surrounding code. No new production method or nontrivial field is added, so no new missing method/field contract was identified. The test comments explain dotted-I and category restoration.
2.2 Test Coverage and Test Stability
Stability: Stable. SeaTunnelDataTypeConvertorUtilTest.java:237-283 asserts actual STRING/INT/TIMESTAMP/DECIMAL/ARRAY/MAP types with fixed values. ReadonlyConfigParserTest.java:206-242 traverses the real config-to-VectorIndex boundary and asserts both enums. Both tests restore base/FORMAT/DISPLAY defaults in finally. No hard waits, service/port dependency, random values, resource leak or collection-order assertion is added. This rating assumes the current sequential JUnit configuration; parallel locale-mutating tests need shared coordination.
Focused residual gaps: these additions do not separately pin nested ROW field-name preservation or every legacy alias under the changed locale; the original-declaration call chain and existing parser tests cover those unchanged branches. A full connector database E2E is not necessary for this API-only token correction: the actual config/parser boundary is already exercised directly.
Exact-head fork Build and Apache Build are successful, with no failed/cancelled executed jobs in the retrieved attempt. This is not local runtime evidence.
Local evidence: fetched/checked out independent branch seatunnel-review-13074, read the entire four-file diff and recursive parser/config/index callers using git show/grep; git diff --check passed against merge base f3e1c2ee3b83efd4a1e7fb4cc4fe40b44060c7d0. No local build, unit/IT/E2E test, container or job execution.
2.3 Documentation Updates
The supported grammar, examples, options and defaults remain the same, and existing EN/ZH schema instructions remain usable. No new configuration or migration guide is required. Do not document unrelated grammar expansion as part of this fix.
3. Architectural Soundness
3.1 Elegance of the Solution
Precise fix. The shared API parser is the root-cause layer used by callers across connectors. Repeating ROOT conversions in individual connectors would leave other consumers broken and add maintenance cost.
3.2 Maintainability
The changes retain one grammar and the original error boundaries. A new generic normalization abstraction would enlarge a six-call fix without improving its contract.
3.3 Extensibility
Use locale-neutral normalization for protocol/schema keywords; keep user identifiers and values untouched. Existing recursive parsing remains reusable.
3.4 Historical-Version Compatibility
No plugin rebuild, checkpoint migration or serialized schema change is required by these calls. Live mixed-version execution was not validated here.
4. Issue Summary
| Number | Issue | Location | Severity |
|---|---|---|---|
| — | No formal issues found | Complete four-file diff | — |
5. Merge Recommendation
Conclusion: Ready to merge
- Blockers — must be fixed
- No source blocker found; required current-head Build is green. Effective maintainer review and repository merge gates still apply.
- Recommended fixes — non-blocking
- No additional unrelated changes requested. The unadded locale variants above are optional hardening, not hidden blockers.
Overall: small, compatible and correctly placed, with discriminating parser assertions. No independent maintainer approval/change request is present in the retrieved history. Daniel's READ-account COMMENT records source clearance; it does not itself satisfy an effective write-reviewer approval or merge-queue requirement. The current comparison drift alone does not justify a sync comment.
Snapshot 2026-11-01T11:47:38.047933+00:00: head 922dad23444c71db2c6841871e788851bcce02fd, base dev; compare diverged, ahead 1 / behind 4; merge blocked / BLOCKED, review decision REVIEW_REQUIRED. Drift is recorded separately; it does not itself request synchronization.
Yes, glad to contribute to Apache SeaTunnel.
Purpose of this pull request
Fixes #13071.
The
schemaoption was parsed with case conversions that use the JVM default locale. Undertr-TRandaz-AZ,iupper cases toİ(U+0130), so lowercase values containing animatched nothing:string,int,bigint,timestamp,decimal(10, 2)and the arrays and maps built from them failed withCOMMON-07 unsupported data type.indexTypeandmetricTypevalues such asivf_flat,inverted,ipandcosinewere rejected, although the schema documentation says both are case insensitive.ReadonlyConfigParserhandles theschemaoption of every connector that has one, so such jobs failed at startup on those workers.All
toUpperCase()calls on this path now useLocale.ROOT:SeaTunnelDataTypeConvertorUtil::50theSqlType.valueOflookup;:130theMAP,ARRAYandDECIMALprefix checks;:196the decimal map key check;:117thelong,shortandbytealiases. These contain noi, so this one never failed. It is changed so that no default locale conversion is left in the class.VectorIndex:IndexType.ofandMetricType.of.Does this PR introduce any user facing change?
Yes, only on workers whose default locale is Turkish or Azerbaijani: values that failed there now parse. I compared
dev's classes with these on 125 type declarations and 81 vector index values, each in lowercase, upper case and capitalised form:tr-TRandaz-AZ: 38 declarations and 25 index values that failed now parse. No value that parsed before gives a different result, and every result now equals theROOTone.ROOT: identical results before and after.So no working job changes, and no entry in
incompatible-changes.mdis needed. No option, default or API signature changed.How was this patch tested?
Two tests, each in the existing test class:
SeaTunnelDataTypeConvertorUtilTest.testParseDoesNotDependOnTheDefaultLocaleparsesstring,int,timestamp,decimal(10, 2),array<int>andmap<decimal(10, 2), string>.ReadonlyConfigParserTest.parseVectorIndexKeyDoesNotDependOnTheDefaultLocaleparses a vector index key withivf_flatandcosine. The existing case insensitivity test useshnswandl2, which contain noi.Both run under
tr-TRandaz-AZ, and restore the base locale and theFORMATandDISPLAYdefaults afterwards. Both fail withdev's classes. Reverting the calls one at a time,:50,:130and:196each fail the first test.I also ran the whole
seatunnel-apisuite in a JVM started with-Duser.language=tr -Duser.country=TR. Ondev, 13 existing schema parsing tests fail, for exampleCatalogTableUtilTest.testSimpleSchemaParse. With this change, 11 of them pass. The other 2,ReadonlyConfigParserTest.parseColumnandparseField, now parse correctly but fail on the test's owntoLowerCase()of the expected type name. The default CI locale is unaffected, so I left those assertions alone. The run also shows 3 failures inGravitinoTableSchemaConvertorTest. That is the metalake type conversion, a separate code path not touched here.There is no E2E change. The failure depends on the default locale of the engine JVM, and the E2E suites run the engine in containers with their own default locale.
Checks, JDK 17:
./mvnw clean test -pl seatunnel-api: 412 tests, 0 failures../mvnw spotless:check -pl seatunnel-api: clean../mvnw -B -T 1 clean test -D"license.skipAddThirdParty"=true -pl seatunnel-ci-tools: 34 tests, 0 failures, 2 skipped by the module.Open PRs #10221 and #11493 also edit
SeaTunnelDataTypeConvertorUtiland its test. A three-way merge with either one is conflict free.Check list
License Notice: none added.
release-note: not applicable, the file was removed fromdevin [Improve] Remove release-note.md in dev branch #9304.