Github user hhbyyh commented on a diff in the pull request:

    https://github.com/apache/spark/pull/19599#discussion_r156770135
  
    --- Diff: mllib/src/main/scala/org/apache/spark/ml/param/params.scala ---
    @@ -435,6 +435,43 @@ class BooleanParam(parent: String, name: String, doc: 
String) // No need for isV
       }
     }
     
    +/**
    + * :: DeveloperApi ::
    + * Specialized version of `Param[String]` for Java.
    + */
    +@DeveloperApi
    +class StringParam(parent: Params, name: String, doc: String, isValid: 
String => Boolean)
    +  extends Param[String](parent, name, doc, isValid) {
    +
    +  private var options: Option[Array[String]] = None
    --- End diff --
    
    Besides enum-like String param, I think it's possible to have other kinds 
of String param in the future, like initialModelPath or modelName. So I'd like 
to keep the flexibility that String Param is able to support both limited 
options and custom validation.
    
    And IMO making the `options` private already provides the required 
isolation even it's a `var`.



---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to