sharpca opened a new issue, #13169:
URL: https://github.com/apache/seatunnel/issues/13169

   ### Search before asking
   
   - [X] I had searched in the 
[issues](https://github.com/apache/seatunnel/issues?q=is%3Aissue+label%3A%22bug%22)
 and found no similar issues.
   - [X] I searched the open and closed pull requests for the affected classes 
and for locale dependent identifier matching.
   
   ### What happened
   
   Several `seatunnel-api` code paths match an identifier or a type name with 
`String#toUpperCase()` / `String#toLowerCase()` **without** `Locale.ROOT`, so 
the result depends on the JVM default locale of the worker.
   
   In a Turkish or Azerbaijani locale `i` and `I` convert to the dotted `İ` and 
the dotless `ı`, so a name that contains an `i` or an `I` no longer matches the 
constant it is compared against.
   
   | Class | Call site | Effect under `tr-TR` |
   | --- | --- | --- |
   | `org.apache.seatunnel.api.common.PluginIdentifier` | `hashCode()` 
lower-cases the engine type, the plugin type and the plugin name | `equals()` 
compares with `StringUtils.equalsIgnoreCase`, which is locale independent, so 
two equal identifiers can get different hash codes and a `HashMap` lookup can 
miss. `PluginIdentifier` is used as a map key by the plugin discovery |
   | `org.apache.seatunnel.api.configuration.util.ConditionEvaluators` | the 
`UPPER_CASE` operator upper-cases the value | `"ID"` is upper-cased to `"İD"`, 
so an upper-case value is reported as **not** upper-case and the option rule 
that uses the operator is rejected |
   | `org.apache.seatunnel.api.metalake.MetalakeConfigUtils` | 
`MetaLakeType.valueOf(metalakeType.toUpperCase())` | the configured type 
`gravitino` becomes `GRAVİTİNO`, which is not a `MetaLakeType` constant, so the 
job fails with `No enum constant 
org.apache.seatunnel.common.constants.MetaLakeType.GRAVİTİNO` |
   | `org.apache.seatunnel.api.metalake.MetaLakeFactory` | the client and the 
mapper registries are keyed by the lower-cased type name and are looked up with 
the lower-cased enum constant name | the registry key is `gravitino` while the 
lookup key is `gravıtıno`, so the lookup fails with `Unknown MetalakeClient 
type: gravıtıno` |
   | 
`org.apache.seatunnel.api.metalake.gravitino.GravitinoTableSchemaConvertor` | 
the Gravitino type names are lower-cased before they are matched | a type name 
that contains an upper-case `I` is lower-cased to a dotless `i` and no longer 
matches, so the column type is not converted |
   
   The metalake path is not dead code: `MetalakeConfigUtils.getMetalakeConfig` 
is called by the Flink and Spark starters and by the Zeta job config parser, so 
a job that enables the metalake fails to start on such a worker.
   
   ### What you expected to happen
   
   The API resolves the same identifier and the same type name on every worker, 
regardless of the JVM default locale of that worker.
   
   ### SeaTunnel Version
   
   dev
   
   ### SeaTunnel Config
   
   Not configuration dependent. The metalake failure needs a job that enables 
the metalake:
   
   ```conf
   env {
     metalake_enabled = true
     metalake_type = "gravitino"
     metalake_url = "http://localhost:8090/api/metalakes/test/";
   }
   ```
   
   ### Running Command
   
   ```shell
   JAVA_TOOL_OPTIONS="-Duser.language=tr -Duser.country=TR" ./bin/seatunnel.sh 
-m local -c config/v2.batch.config.template
   ```
   
   ### Error Exception
   
   ```text
   java.lang.IllegalArgumentException: No enum constant 
org.apache.seatunnel.common.constants.MetaLakeType.GRAVİTİNO
   ```
   
   ### Zeta or Flink or Spark Version
   
   Not engine specific: the conversion happens in the shared API module.
   
   ### Java or Scala Version
   
   Not version specific. Reproduced on JDK 17 with `-Duser.language=tr 
-Duser.country=TR`.
   
   ### Are you willing to submit PR?
   
   - [X] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [X] I agree to follow this project's Code of Conduct.
   


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