Skip to content

Commit

Permalink
Use withColumn in transform
Browse files Browse the repository at this point in the history
  • Loading branch information
yu-iskw committed Jul 1, 2015
1 parent d3a79f7 commit 93aa2ff
Showing 1 changed file with 1 addition and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -115,10 +115,7 @@ class KMeansModel private[ml] (
}

override def transform(dataset: DataFrame): DataFrame = {
dataset.select(
dataset("*"),
callUDF(predict _, IntegerType, col($(featuresCol))).as($(predictionCol))
)
dataset.withColumn($(predictionCol), callUDF(predict _, IntegerType, col($(featuresCol))))
}

override def transformSchema(schema: StructType): StructType = {
Expand Down

0 comments on commit 93aa2ff

Please sign in to comment.