fred-db commented on code in PR #46401: URL: https://github.com/apache/spark/pull/46401#discussion_r1596643601
########## sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/optimizer/joins.scala: ########## @@ -400,11 +395,32 @@ trait JoinSelectionHelper { } } - def canPlanAsBroadcastHashJoin(join: Join, conf: SQLConf): Boolean = { - getBroadcastBuildSide(join.left, join.right, join.joinType, - join.hint, hintOnly = true, conf).isDefined || - getBroadcastBuildSide(join.left, join.right, join.joinType, - join.hint, hintOnly = false, conf).isDefined + protected def hashJoinSupported + (leftKeys: Seq[Expression], rightKeys: Seq[Expression]): Boolean = { + val result = leftKeys.concat(rightKeys).forall(e => UnsafeRowUtils.isBinaryStable(e.dataType)) + if (!result) { + val keysNotSupportingHashJoin = leftKeys.concat(rightKeys).filterNot( + e => UnsafeRowUtils.isBinaryStable(e.dataType)) + logWarning(log"Hash based joins are not supported due to joining on keys that don't " + + log"support binary equality. Keys not supporting hash joins: " + + log"${ + MDC(HASH_JOIN_KEYS, keysNotSupportingHashJoin.map( + e => e.toString + " due to DataType: " + e.dataType.typeName).mkString(", ")) + }") + } + result + } + + def canPlanAsBroadcastHashJoin(join: Join, conf: SQLConf): Boolean = join match { Review Comment: No, the `JoinSelection` is unaffected. It's only called in `PushDownLeftSemiAntiJoin` -- 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