SEPURI-SAI-KRISHNA opened a new pull request, #13063:
URL: https://github.com/apache/seatunnel/pull/13063

   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 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: the JDBC 
sink starts, and `field_ide = lowercase | uppercase` produces the same 
identifiers as on any other worker. There is no `incompatible-changes.md` 
entry, because on those workers every JDBC sink already failed when its writer 
was created, so no working job changes.
   
   ### How was this patch tested?
   
   **Unit tests**, one new case in each of the two 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`.
   
   Both 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 | both tests fail with `No enum constant 
...FieldIdeEnum.ORİGİNAL` |
   | only the identifier conversion | both tests fail with `expected: <user_id> 
but was: <user_ıd>` |
   
   **E2E.** Not added. The JDBC E2E suites run with the container JVM's default 
locale, so they cannot reach this without forcing a Turkish locale on the whole 
engine. The unit tests cover the exact call `JdbcSink.createWriter` makes.
   
   **Build checks**, JDK 17:
   
   - `./mvnw clean test -pl seatunnel-connectors-v2/connector-jdbc`, 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.
   
   ### Check list
   
   * [X] Code changed are covered with tests, or it does not need tests for 
reason
   * [X] If any new Jar binary package adding in your PR, please add License 
Notice according to
     [License 
Notice](https://github.com/apache/seatunnel/blob/dev/docs/en/contribution/new-license.md):
 none added.
   * [X] If necessary, please update the documentation to describe the new 
feature: not needed. The `field_ide` documentation does not mention the locale, 
and the behaviour now matches it on every worker.
   * [X] If you are contributing the connector code, please check that the 
following files are updated:
     1. Update 
[plugin-mapping.properties](https://github.com/apache/seatunnel/blob/dev/plugin-mapping.properties):
 not needed, no new connector.
     2. Update the pom file of 
[seatunnel-dist](https://github.com/apache/seatunnel/blob/dev/seatunnel-dist/pom.xml):
 not needed, no new module.
     3. Add ci label in 
[label-scope-conf](https://github.com/apache/seatunnel/blob/dev/.github/workflows/labeler/label-scope-conf.yml):
 not needed, no new module.
     4. Add e2e test for your connector: not added, see above.
     5. Update [connector-v2 
doc](https://github.com/apache/seatunnel/tree/dev/docs/en/connectors): not 
needed, see above.
   * [X] Update the `release-note`: not applicable, the file was removed from 
`dev` in #9304.
   


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to