Github user yanboliang commented on a diff in the pull request: https://github.com/apache/spark/pull/18554#discussion_r126868713 --- Diff: mllib/src/main/scala/org/apache/spark/ml/classification/OneVsRest.scala --- @@ -317,7 +318,12 @@ final class OneVsRest @Since("1.4.0") ( val numClasses = MetadataUtils.getNumClasses(labelSchema).fold(computeNumClasses())(identity) instr.logNumClasses(numClasses) - val multiclassLabeled = dataset.select($(labelCol), $(featuresCol)) + val multiclassLabeled = getClassifier match { + // SPARK-21306: cache weightCol if necessary + case c: HasWeightCol if c.isDefined(c.weightCol) && c.getWeightCol.nonEmpty => + dataset.select($(labelCol), $(featuresCol), c.getWeightCol) + case _ => dataset.select($(labelCol), $(featuresCol)) + } --- End diff -- @facaiy It doesn't matter. If the classifier doesn't inherit from ```HasWeightCol```, we don't run ```setWeightCol``` for that classifier instead of printing out warning log to say ```weightCol``` doesn't take effect. You can refer [these lines of code](https://github.com/apache/spark/blob/master/mllib/src/main/scala/org/apache/spark/ml/classification/OneVsRest.scala#L338) to learn how ```featuresCol``` be handled. Thanks.
--- 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