tlfua opened a new pull request, #7554:
URL: https://github.com/apache/datafusion-comet/pull/7554
## Which issue does this PR close?
<!--
We generally require a GitHub issue to be filed for all bug fixes and
enhancements and this helps us generate change logs for our releases. You can
link an issue to this PR using the GitHub syntax. For example `Closes #123`
indicates that this PR will close issue #123.
-->
Closes #6815.
## Rationale for this change
<!--
Why are you proposing this change? If this is already explained clearly in
the issue then this section is not needed.
Explaining clearly why changes are proposed helps reviewers understand your
changes and offer better suggestions for fixes.
-->
With AQE off, `CometExecRule.rewriteInSubqueryPlan` only converts a DPP
`SubqueryBroadcastExec` to a `CometSubqueryBroadcastExec` when the broadcast's
child is a `CometNativeExec`. The join's own broadcast converts to a
`CometBroadcastExchangeExec` over more plans than that, because
`CometUnionExec`, `CometCoalesceExec`, `CometTakeOrderedAndProjectExec` and
`CometShuffleExchangeExec` are wrapped in a native placeholder while the join
is converted. For those build sides the DPP subquery keeps a Spark
`BroadcastExchange`, `ReuseExchangeAndSubquery` can't match it to the join's
exchange, and the dimension is broadcast twice.
The AQE path already accepts any columnar `CometPlan` in
`CometPlanAdaptiveDynamicPruningFilters.isNativeBuildSide` (#6786), so this
only changes the non-AQE path.
## What changes are included in this PR?
<!--
There is no need to duplicate the description in the issue here but it is
sometimes worth providing a summary of the individual changes in this PR.
-->
- `CometExecRule.rewriteInSubqueryPlan` now requires `CometPlan &&
supportsColumnar` instead of `CometNativeExec`, the same check as
`isNativeBuildSide`. `CometBroadcastExchangeExec` only needs a child that
supports `executeColumnar()`, so a child admitted by this check runs correctly.
If the DPP side converts a plan the join side didn't, the only effect is that
the two exchanges don't match and reuse is lost, as before.
- Updated the comment in `CometPlanAdaptiveDynamicPruningFilters` that
pointed to the old non-AQE check, and a stale comment in an existing test that
named `CometNativeExec`.
Build sides this change newly admits:
| Top operator of the build side | Tested | Why not |
| --- | --- | --- |
| `CometUnionExec` | yes | |
| `CometCoalesceExec` | yes | |
| `CometShuffleExchangeExec` | yes | |
| `CometTakeOrderedAndProjectExec` | yes | |
| `CometCollectLimitExec` | no | Spark plans `CollectLimit` only at the root
of a query |
| `CometLocalTableScanExec`, `CometEmptyRelation` | no | The optimizer folds
these away, and DPP needs a selective filter on the build side |
| `CometSparkToColumnarExec`, `CometScanExec`, `CometBatchScanExec`,
`CometInMemoryTableScanExec` | no | DPP needs a selective filter on the build
side, and Comet runs that filter natively above the scan, so these are not the
top operator |
## How are these changes tested?
<!--
We typically require tests for all PRs in order to:
1. Prevent the code from being accidentally broken by subsequent changes
2. Serve as another way to document the expected behavior of the code
If tests are not included in your PR, please explain why (for example, are
they covered by existing tests)?
-->
Added four tests to `CometExecSuite`, one for each tested shape in the table
above. Each runs a non-AQE broadcast join with DPP in reuse-only mode. Each
test asserts these things:
- The answer matches Spark.
- There is exactly one `CometBroadcastExchangeExec`.
- The broadcast's direct child is the expected operator, so the test can't
pass on a build side that was already a `CometNativeExec`.
- The DPP subquery is a `CometSubqueryBroadcastExec`.
- The DPP subquery reuses the join's broadcast.
No TPC-DS approved plan has a Spark `BroadcastExchange` under a
`SubqueryBroadcast`, so no golden files change.
Local checks:
- `./mvnw compile test-compile scalafix:scalafix -Psemanticdb` and `./mvnw
spotless:check`: passed.
- I did not run the new tests locally.
Fork CI: https://github.com/tlfua/datafusion-comet/actions/runs/42359642929
(in progress).
--
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]