srowen commented on a change in pull request #24793: [SPARK-27944][ML] Unify
the behavior of checking empty output column names
URL: https://github.com/apache/spark/pull/24793#discussion_r302581926
##########
File path:
mllib/src/main/scala/org/apache/spark/ml/clustering/BisectingKMeans.scala
##########
@@ -107,9 +107,15 @@ class BisectingKMeansModel private[ml] (
@Since("2.0.0")
override def transform(dataset: Dataset[_]): DataFrame = {
transformSchema(dataset.schema, logging = true)
- val predictUDF = udf((vector: Vector) => predict(vector))
- dataset.withColumn($(predictionCol),
- predictUDF(DatasetUtils.columnToVector(dataset, getFeaturesCol)))
+ if ($(predictionCol).nonEmpty) {
+ val predictUDF = udf((vector: Vector) => predict(vector))
+ dataset.withColumn($(predictionCol),
+ predictUDF(DatasetUtils.columnToVector(dataset, getFeaturesCol)))
+ } else {
+ this.logWarning(s"$uid: BisectingKMeansModel.transform() was called as
NOOP" +
Review comment:
PS we should fix these messages. "called as NOOP" is cryptic. Just say
"transform() does nothing because ..."
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]