comphead commented on code in PR #6270:
URL: https://github.com/apache/datafusion-comet/pull/6270#discussion_r4285711682
##########
spark/src/test/scala/org/apache/spark/sql/CometTestBase.scala:
##########
@@ -78,6 +78,15 @@ abstract class CometTestBase
assert(reused.nonEmpty, s"$clue:\n$plan")
}
+ /** Asserts that no reused exchange in `plan` sits over a scan that
`dppScan` matches. */
+ protected def assertNoReusedExchangeOverDppScan[T](plan: SparkPlan)(
+ dppScan: PartialFunction[SparkPlan, T]): Unit = {
+ val reused = collect(plan) {
+ case exchange: ReusedExchangeExec if
collect(exchange.child)(dppScan).nonEmpty => exchange
+ }
+ assert(reused.isEmpty, s"An exchange over a DPP scan was reused by another
branch:\n$plan")
+ }
Review Comment:
This and `assertExchangeReuseOver` just above now run the same `collect` and
differ only in `isEmpty` against `nonEmpty`. Could both call one
`reusedExchangesOver(plan)(pf)`?
The "Comet reuses as many exchanges as Spark" check is also written twice,
as a local `reused` plus two asserts in `CometExecSuite` (line 1886) and in
`CometDeltaNativeScanSuite` (line 1973). A helper next to these, taking the
Spark and Comet plans, would keep that comparison and its message in one place
too.
--
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]