You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2021/08/02 12:20:00 UTC

[GitHub] [spark] ulysses-you commented on a change in pull request #32355: [SPARK-35221][SQL] Add join hint build side check

ulysses-you commented on a change in pull request #32355:
URL: https://github.com/apache/spark/pull/32355#discussion_r680923147



##########
File path: sql/core/src/test/scala/org/apache/spark/sql/JoinHintSuite.scala
##########
@@ -597,4 +597,68 @@ 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(_.startsWith("A join hint"))

Review comment:
       thank you @HyukjinKwon , agree. Change to `assert(logs.nonEmpty)` that ensure `logs.forall` works.




-- 
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-unsubscribe@spark.apache.org

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



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