LuciferYang commented on code in PR #50636:
URL: https://github.com/apache/spark/pull/50636#discussion_r2050223677


##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/optimizer/joins.scala:
##########
@@ -293,19 +293,19 @@ trait JoinSelectionHelper extends Logging {
       join: Join,
       hintOnly: Boolean,
       conf: SQLConf): Option[BuildSide] = {
-    val buildLeft = if (hintOnly) {
+    lazy val buildLeft = if (hintOnly) {
       hintToBroadcastLeft(join.hint)
     } else {
       canBroadcastBySize(join.left, conf) && !hintToNotBroadcastLeft(join.hint)
     }
-    val buildRight = if (hintOnly) {
+    lazy val buildRight = if (hintOnly) {
       hintToBroadcastRight(join.hint)
     } else {
       canBroadcastBySize(join.right, conf) && 
!hintToNotBroadcastRight(join.hint)
     }
     getBuildSide(
-      buildLeft && canBuildBroadcastLeft(join.joinType),
-      buildRight && canBuildBroadcastRight(join.joinType),
+      canBuildBroadcastLeft(join.joinType) && buildLeft,

Review Comment:
   It seems these `val` won't be reused either? Could we use `def` instead? 
Using `lazy val` also involves locking primitives.



-- 
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: reviews-unsubscr...@spark.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to