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

    https://github.com/apache/spark/pull/15428#discussion_r83181476
  
    --- 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) =>
    +      Bucketizer.binarySearchForBuckets($(splits), feature, flag)
    +    }
    +    val filteredDataset = {
    --- End diff --
    
    I don't see that the method handles `NaN` below. What binarySearch returns 
is undefined. One place or the other I think this has to be explicitly handled.


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