dbatomic commented on code in PR #46599:
URL: https://github.com/apache/spark/pull/46599#discussion_r1604640371
##########
sql/core/src/test/scala/org/apache/spark/sql/CollationSuite.scala:
##########
@@ -778,25 +778,25 @@ class CollationSuite extends DatasourceV2SQLBase with
AdaptiveSparkPlanHelper {
val df1 = spark.createDataFrame(sparkContext.parallelize(in), schema)
// Binary collations are allowed to use hash join.
- assert(collectFirst(
- df1.hint("broadcast").join(df1, df1("col_binary") === df1("col_binary"))
- .queryExecution.executedPlan) {
+ val bJoin = df1.hint("broadcast").join(df1, df1("col_binary") ===
df1("col_binary"))
+ val binaryJoinPlan = bJoin.queryExecution.executedPlan
+ assert(collectFirst(binaryJoinPlan) {
case _: BroadcastHashJoinExec => ()
}.nonEmpty)
- // Even with hint broadcast, hash join is not used for non-binary collated
strings.
- assert(collectFirst(
- df1.hint("broadcast").join(df1, df1("col_non_binary") ===
df1("col_non_binary"))
- .queryExecution.executedPlan) {
+ // Hash join is also used for non-binary collated strings.
+ val nbJoin = df1.hint("broadcast").join(df1, df1("col_non_binary") ===
df1("col_non_binary"))
+ val non_binaryJoinPlan = nbJoin.queryExecution.executedPlan
+ assert(collectFirst(non_binaryJoinPlan) {
case _: BroadcastHashJoinExec => ()
- }.isEmpty)
+ }.nonEmpty)
+ // This is possible because CollationKey is injected into the plan.
+ assert(non_binaryJoinPlan.toString().contains("collationkey"))
Review Comment:
Can you explicitly do the check instead of toString + contains?
e.g. once you get into `BroadcastHashJoinExec` you should be able to get the
key.
--
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]