srowen commented on a change in pull request #25133: [SPARK-28365][ML] Fallback 
locale to en_US in StopWordsRemover if system default locale isn't in available 
locales in JVM
URL: https://github.com/apache/spark/pull/25133#discussion_r303254034
 
 

 ##########
 File path: 
mllib/src/main/scala/org/apache/spark/ml/feature/StopWordsRemover.scala
 ##########
 @@ -105,8 +106,23 @@ class StopWordsRemover @Since("1.5.0") (@Since("1.5.0") 
override val uid: String
   @Since("2.4.0")
   def getLocale: String = $(locale)
 
+  /**
+   * Returns the string of system default locale, or `Locale.US.toString` if 
the default locale
+   * isn't in available locales in JVM.
+   */
+  private val getDefaultOrUS: String = {
+    if 
(Locale.getAvailableLocales.map(_.toString).contains(Locale.getDefault.toString))
 {
 
 Review comment:
   There's no need for all of the `.toString` in this method. Just compare and 
return `Locale`s and let the caller make a string

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to