ulysses-you commented on a change in pull request #32355:
URL: https://github.com/apache/spark/pull/32355#discussion_r683503861
##########
File path: sql/core/src/test/scala/org/apache/spark/sql/JoinHintSuite.scala
##########
@@ -597,4 +597,82 @@ class JoinHintSuite extends PlanTest with
SharedSparkSession with AdaptiveSparkP
assert(df9.collect().size == df10.collect().size)
}
}
+
+ test("SPARK-35221: Add join hint build side check") {
+ withSQLConf(SQLConf.AUTO_BROADCASTJOIN_THRESHOLD.key -> "-1",
+ SQLConf.PREFER_SORTMERGEJOIN.key -> "true") {
+ Seq("left_outer", "left_semi", "left_anti").foreach { joinType =>
+ val hintAppender = new LogAppender(s"join hint build side check for
$joinType")
+ withLogAppender(hintAppender, level = Some(Level.WARN)) {
+ assertShuffleMergeJoin(
+ df1.hint("BROADCAST").join(df2, $"a1" === $"b1", joinType))
+ assertBroadcastHashJoin(
+ df1.join(df2.hint("BROADCAST"), $"a1" === $"b1", joinType),
BuildRight)
+
+ assertShuffleMergeJoin(
+ df1.hint("SHUFFLE_HASH").join(df2, $"a1" === $"b1", joinType))
+ assertShuffleHashJoin(
+ df1.join(df2.hint("SHUFFLE_HASH"), $"a1" === $"b1", joinType),
BuildRight)
+ }
+
+ val logs = hintAppender.loggingEvents.map(_.getRenderedMessage)
+ .filter(_.contains("is not supported in the query:"))
+ assert(logs.nonEmpty)
Review comment:
It should be. According to the
https://github.com/apache/spark/pull/32355#discussion_r680435570 and to make it
clear. Now I split the related test into parties: positive and negative. I
think it would be less flaky FYI @HyukjinKwon .
--
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]