Github user yanboliang commented on a diff in the pull request: https://github.com/apache/spark/pull/15777#discussion_r88252426 --- Diff: mllib/src/main/scala/org/apache/spark/ml/clustering/BisectingKMeans.scala --- @@ -132,7 +132,7 @@ class BisectingKMeansModel private[ml] ( private var trainingSummary: Option[BisectingKMeansSummary] = None private[clustering] def setSummary(summary: BisectingKMeansSummary): this.type = { - this.trainingSummary = Some(summary) + this.trainingSummary = Option(summary) --- End diff -- I'd more prefer to make the argument as ```Option[BisectingKMeansSummary]``` like: ``` private[clustering] def setSummary(summary: Option[BisectingKMeansSummary]): this.type = { this.trainingSummary = summary this } ``` And test ```summary == None``` by: ``` model.setSummary(None) assert(!model.hasSummary) ``` Since I think ```setSummary(null)``` and test whether it existing is very tricky. The type of ```summary``` is ```Option[BisectingKMeansSummary]``` and with ```None``` as default value, so ```setSummary(None)``` should make more sense for the scenario that the model does not have summary. I saw the reason for make this change is that you want to call ```setSummary``` at Python side, and Python None would be converted to ```null``` in Scala. But I think this is private function, we don't need to run test across Scala and Python, since private function should not be called by users.
--- 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