zhengruifeng commented on a change in pull request #31472:
URL: https://github.com/apache/spark/pull/31472#discussion_r570744185
##########
File path:
mllib/src/main/scala/org/apache/spark/ml/classification/OneVsRest.scala
##########
@@ -185,71 +185,56 @@ final class OneVsRestModel private[ml] (
return dataset.toDF
}
- // determine the input columns: these need to be passed through
- val origCols = dataset.schema.map(f => col(f.name))
-
// add an accumulator column to store predictions of all the models
val accColName = "mbc$acc" + UUID.randomUUID().toString
- val initUDF = udf { () => Map[Int, Double]() }
- val newDataset = dataset.withColumn(accColName, initUDF())
+ val newDataset = dataset.withColumn(accColName,
lit(Array.emptyDoubleArray))
// persist if underlying dataset is not persistent.
val handlePersistence = !dataset.isStreaming && dataset.storageLevel ==
StorageLevel.NONE
- if (handlePersistence) {
- newDataset.persist(StorageLevel.MEMORY_AND_DISK)
- }
+ if (handlePersistence) newDataset.persist(StorageLevel.MEMORY_AND_DISK)
Review comment:
ok, I will ignore similar case in the future.
----------------------------------------------------------------
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]