cloud-fan commented on a change in pull request #32861:
URL: https://github.com/apache/spark/pull/32861#discussion_r662501923
##########
File path:
sql/core/src/main/scala/org/apache/spark/sql/execution/adaptive/PlanAdaptiveDynamicPruningFilters.scala
##########
@@ -62,8 +63,19 @@ case class PlanAdaptiveDynamicPruningFilters(
val broadcastValues = SubqueryBroadcastExec(
name, index, buildKeys, newAdaptivePlan)
DynamicPruningExpression(InSubqueryExec(value, broadcastValues,
exprId))
- } else {
+ } else if (onlyInBroadcast) {
DynamicPruningExpression(Literal.TrueLiteral)
+ } else {
+ // we need to apply an aggregate on the buildPlan in order to be
column pruned
+ val alias = Alias(buildKeys(index), buildKeys(index).toString)()
+ val aggregate = Aggregate(Seq(alias), Seq(alias), buildPlan)
+
+ val optimized = adaptivePlan.optimizer.execute(aggregate)
Review comment:
Ideally we should run the normal optimizer before planning the plan, why
do you call the AQE optimizer here? I don't think there is any logical query
stage in the plan.
--
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]