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


##########
connector/connect/client/jvm/src/test/scala/org/apache/spark/sql/ClientE2ETestSuite.scala:
##########
@@ -489,17 +489,31 @@ class ClientE2ETestSuite extends RemoteSparkSession {
   }
 
   test("ambiguous joins") {
+    spark.conf.set("spark.sql.autoBroadcastJoinThreshold", "-1")
     val left = spark.range(100).select(col("id"), rand(10).as("a"))
     val right = spark.range(100).select(col("id"), rand(12).as("a"))
     val joined = left.join(right, left("id") === 
right("id")).select(left("id"), right("a"))
     assert(joined.schema.catalogString === "struct<id:bigint,a:double>")
+    testCapturedStdOut(joined.explain(), "BroadcastHashJoin")
+    spark.conf.set("spark.sql.autoBroadcastJoinThreshold", "10MB")
 
     val joined2 = left
       .join(right, left.colRegex("id") === right.colRegex("id"))
       .select(left("id"), right("a"))
     assert(joined2.schema.catalogString === "struct<id:bigint,a:double>")
   }
 
+  test("broadcast join") {
+    spark.conf.set("spark.sql.autoBroadcastJoinThreshold", "-1")
+    val left = spark.range(100).select(col("id"), rand(10).as("a"))
+    val right = spark.range(100).select(col("id"), rand(12).as("a"))
+    val joined =
+      left.join(broadcast(right), left("id") === 
right("id")).select(left("id"), right("a"))
+    assert(joined.schema.catalogString === "struct<id:bigint,a:double>")
+    testCapturedStdOut(joined.explain(), "BroadcastHashJoin")
+    spark.conf.set("spark.sql.autoBroadcastJoinThreshold", "10MB")

Review Comment:
   Should we move `SQLHelper` to client module later? `withSQLConf` and other 
functions are more useful
   
   



##########
connector/connect/client/jvm/src/test/scala/org/apache/spark/sql/ClientE2ETestSuite.scala:
##########
@@ -489,17 +489,31 @@ class ClientE2ETestSuite extends RemoteSparkSession {
   }
 
   test("ambiguous joins") {
+    spark.conf.set("spark.sql.autoBroadcastJoinThreshold", "-1")
     val left = spark.range(100).select(col("id"), rand(10).as("a"))
     val right = spark.range(100).select(col("id"), rand(12).as("a"))
     val joined = left.join(right, left("id") === 
right("id")).select(left("id"), right("a"))
     assert(joined.schema.catalogString === "struct<id:bigint,a:double>")
+    testCapturedStdOut(joined.explain(), "BroadcastHashJoin")
+    spark.conf.set("spark.sql.autoBroadcastJoinThreshold", "10MB")
 
     val joined2 = left
       .join(right, left.colRegex("id") === right.colRegex("id"))
       .select(left("id"), right("a"))
     assert(joined2.schema.catalogString === "struct<id:bigint,a:double>")
   }
 
+  test("broadcast join") {
+    spark.conf.set("spark.sql.autoBroadcastJoinThreshold", "-1")
+    val left = spark.range(100).select(col("id"), rand(10).as("a"))
+    val right = spark.range(100).select(col("id"), rand(12).as("a"))
+    val joined =
+      left.join(broadcast(right), left("id") === 
right("id")).select(left("id"), right("a"))
+    assert(joined.schema.catalogString === "struct<id:bigint,a:double>")
+    testCapturedStdOut(joined.explain(), "BroadcastHashJoin")
+    spark.conf.set("spark.sql.autoBroadcastJoinThreshold", "10MB")

Review Comment:
   Should we copy `SQLHelper` to client module later? `withSQLConf` and other 
functions are more useful
   
   



-- 
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