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

    https://github.com/apache/spark/pull/15428#discussion_r83911300
  
    --- Diff: mllib/src/main/scala/org/apache/spark/ml/feature/Bucketizer.scala 
---
    @@ -73,15 +78,27 @@ final class Bucketizer @Since("1.4.0") (@Since("1.4.0") 
override val uid: String
       @Since("1.4.0")
       def setOutputCol(value: String): this.type = set(outputCol, value)
     
    +  /** @group setParam */
    +  @Since("2.1.0")
    +  def setHandleInvalid(value: String): this.type = set(handleInvalid, 
value)
    +  setDefault(handleInvalid, "error")
    +
       @Since("2.0.0")
       override def transform(dataset: Dataset[_]): DataFrame = {
         transformSchema(dataset.schema)
    -    val bucketizer = udf { feature: Double =>
    -      Bucketizer.binarySearchForBuckets($(splits), feature)
    +    val bucketizer: UserDefinedFunction = udf { (feature: Double, flag: 
String) =>
    --- End diff --
    
    Also, at this point, you already know the value for flag, so you can just 
use it here, rather than making the UDF take an extra argument.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

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

Reply via email to