wangyum commented on code in PR #59027:
URL: https://github.com/apache/spark/pull/59027#discussion_r4242021142
##########
sql/core/src/test/scala/org/apache/spark/sql/execution/adaptive/AdaptiveQueryExecSuite.scala:
##########
@@ -2874,6 +2874,83 @@ class AdaptiveQueryExecSuite
assert(LogicalQueryStageStrategy(nullAwareAntiJoinWithRegularStage).isEmpty)
}
+ test("LogicalQueryStageStrategy reuses a range broadcast only for the same
keys") {
+ val leftAttr = AttributeReference("a", IntegerType)()
+ val lo = AttributeReference("lo", IntegerType)()
+ val hi = AttributeReference("hi", IntegerType)()
+ val left = LocalRelation(leftAttr)
+ val right = LocalRelation(lo, hi)
+ val cond = LessThan(leftAttr, lo)
+
+ def stage(mode: RangeBroadcastMode): LogicalQueryStage = {
+ val scan = LocalTableScanExec(right.output, Nil, None)
+ val exchange = BroadcastExchangeExec(mode, scan)
+ LogicalQueryStage(right, BroadcastQueryStageExec(0, exchange, exchange))
+ }
+
+ def modeFor(buildKey: AttributeReference): RangeBroadcastMode = {
+ val bound: Expression = BindReferences.bindReference(buildKey,
right.output)
+ RangeBroadcastMode(Seq(bound), PointIndexKind)
Review Comment:
Added. Extended the test with `wrongKindMode =
RangeBroadcastMode(Seq(boundLo), IntervalIndexKind)`.
--
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]