Github user VinceShieh commented on a diff in the pull request:
    --- 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
       def setOutputCol(value: String): this.type = set(outputCol, value)
    +  /** @group setParam */
    +  @Since("2.1.0")
    +  def setHandleInvalid(value: String): this.type = set(handleInvalid, 
    +  setDefault(handleInvalid, "error")
       override def transform(dataset: Dataset[_]): DataFrame = {
    -    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 --
    Nope, actually, NaN will trigger an error later in binarySearchForBuckets 
as an invalid feature value if no special handling is made.

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 or file a JIRA ticket
with INFRA.

To unsubscribe, e-mail:
For additional commands, e-mail:

Reply via email to