wangyum opened a new pull request, #36847:
URL: https://github.com/apache/spark/pull/36847
### What changes were proposed in this pull request?
This PR adds `ReplaceCTERefWithRepartition` into nonExcludableRules list.
### Why are the changes needed?
It will throw exception if user `set
spark.sql.optimizer.excludedRules=org.apache.spark.sql.catalyst.optimizer.ReplaceCTERefWithRepartition`
before running this query:
```sql
SELECT
(SELECT avg(id) FROM range(10)),
(SELECT sum(id) FROM range(10)),
(SELECT count(distinct id) FROM range(10))
```
Exception:
```
Caused by: java.lang.AssertionError: assertion failed: No plan for WithCTE
:- CTERelationDef 0, true
: +- Project [named_struct(min(id), min(id)#223L, sum(id), sum(id)#226L,
count(DISTINCT id), count(DISTINCT id)#229L) AS mergedValue#240]
: +- Aggregate [min(id#221L) AS min(id)#223L, sum(id#221L) AS
sum(id)#226L, count(distinct id#221L) AS count(DISTINCT id)#229L]
: +- Range (0, 10, step=1, splits=None)
+- Project [scalar-subquery#218 [].min(id) AS scalarsubquery()#230L,
scalar-subquery#219 [].sum(id) AS scalarsubquery()#231L, scalar-subquery#220
[].count(DISTINCT id) AS scalarsubquery()#232L]
: :- CTERelationRef 0, true, [mergedValue#240]
: :- CTERelationRef 0, true, [mergedValue#240]
: +- CTERelationRef 0, true, [mergedValue#240]
+- OneRowRelation
```
### Does this PR introduce _any_ user-facing change?
No.
### How was this patch tested?
Unit test.
--
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]