cloud-fan commented on code in PR #44526:
URL: https://github.com/apache/spark/pull/44526#discussion_r1437652477
##########
mllib/src/main/scala/org/apache/spark/ml/recommendation/ALS.scala:
##########
@@ -324,13 +324,22 @@ class ALSModel private[ml] (
// create a new column named map(predictionCol) by running the predict UDF.
val validatedUsers = checkIntegers(dataset, $(userCol))
val validatedItems = checkIntegers(dataset, $(itemCol))
+
+ val validatedInputAlias = Identifiable.randomUID("__als_validated_input")
+ val itemFactorsAlias = Identifiable.randomUID("__als_item_factors")
+ val userFactorsAlias = Identifiable.randomUID("__als_user_factors")
+
val predictions = dataset
- .join(userFactors,
- validatedUsers === userFactors("id"), "left")
- .join(itemFactors,
- validatedItems === itemFactors("id"), "left")
- .select(dataset("*"),
- predict(userFactors("features"),
itemFactors("features")).as($(predictionCol)))
+ .withColumns(Seq($(userCol), $(itemCol)), Seq(validatedUsers,
validatedItems))
Review Comment:
oh, previously `validatedUsers` was directly used in the join condition, now
we materialize it first and reference only columns in the join condition.
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]