zhengruifeng opened a new pull request #35893: URL: https://github.com/apache/spark/pull/35893
### What changes were proposed in this pull request? 1, add validation methods in `DatasetUtils`; 2, use the new methods to check the input dataset; ### Why are the changes needed? LinearSVC should fail fast if the input dataset contains invalid values: ``` import org.apache.spark.ml.feature._ import org.apache.spark.ml.linalg._ import org.apache.spark.ml.classification._ import org.apache.spark.ml.clustering._ val df = sc.parallelize(Seq(LabeledPoint(1.0, Vectors.dense(1.0, Double.NaN)), LabeledPoint(0.0, Vectors.dense(Double.PositiveInfinity, 2.0)))).toDF() val svc = new LinearSVC() val model = svc.fit(df) scala> model.intercept res0: Double = NaN scala> model.coefficients res1: org.apache.spark.ml.linalg.Vector = [NaN,NaN] ``` ### Does this PR introduce _any_ user-facing change? No ### How was this patch tested? added test -- 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. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
