Arawoof06 opened a new issue, #1311:
URL: https://github.com/apache/arrow-java/issues/1311

   `IntervalStringUtils.formatIntervalYear` and `formatIntervalDay` build the 
Oracle-style `INTERVAL YEAR TO MONTH` / `INTERVAL DAY TO SECOND` strings that 
the JDBC interval accessor returns from `getString()`/`getObject()` with 
`String.format("...%d...", ...)` and no explicit `Locale`. 
`java.util.Formatter` localises `%d` digits with the JVM default locale, so on 
a JVM whose default locale uses non-ASCII digits (e.g. `ar-EG`, `bn-BD`, 
`mr-IN`) an interval renders as `+٠٢١-٠٢` instead of `+021-02`. The value 
handed back to JDBC clients is then non-ASCII and any downstream code that 
parses it as `[+-]YYY-MM` / `[+-]DDD HH:MM:SS.mmm` breaks.
   
   This is the same root cause as GH-1300 (C Data Interface format strings), 
just in the JDBC layer. Fix is to pass `Locale.ROOT` to the two `String.format` 
calls.
   
   **Reproduction**
   ```java
   Locale.setDefault(Locale.forLanguageTag("ar-EG"));
   IntervalStringUtils.formatIntervalYear(Period.of(21, 2, 0)); // returns 
"+٠٢١-٠٢", expected "+021-02"
   ```


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