snuyanzin commented on code in PR #3113:
URL: https://github.com/apache/calcite/pull/3113#discussion_r1213124528
##########
core/src/main/java/org/apache/calcite/sql/parser/SqlParserUtil.java:
##########
@@ -738,17 +741,7 @@ public static ParsedCollation parseCollation(String in) {
}
Charset charset = SqlUtil.getCharset(charsetStr);
- String[] localeParts = localeStr.split("_");
- Locale locale;
- if (1 == localeParts.length) {
- locale = new Locale(localeParts[0]);
- } else if (2 == localeParts.length) {
- locale = new Locale(localeParts[0], localeParts[1]);
- } else if (3 == localeParts.length) {
- locale = new Locale(localeParts[0], localeParts[1], localeParts[2]);
- } else {
- throw RESOURCE.illegalLocaleFormat(localeStr).ex();
Review Comment:
I'm ok with `Locale.Builder.setLanguageTag`
the only thing we should probably handle is that current behavior: in case
of empty `localeString` it returns `Locale.ROOT` while
`Locale.Builder.setLanguageTag` fails
Also added actual `localeStr` in exception message since
`IllformedLocaleException` throwing by `setLamguageTag` does not contain it
--
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]