zabetak commented on code in PR #3113:
URL: https://github.com/apache/calcite/pull/3113#discussion_r1198975782


##########
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 am not sure if we should use `Locale.forLanguageTag` or 
`Locale.Builder.setLanguageTag` 
(https://docs.oracle.com/javase/8/docs/api/java/util/Locale.Builder.html#setLanguageTag-java.lang.String-).
 Is it safe to just ignore malformed inputs?
   
   Do all Calcite unit tests run if we use `setLanguageTag`?
   
   Are we sure that we do not break some SQL standard specification around 
`COLLATE` clause (etc.) by doing this change?



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