cloud-fan commented on a change in pull request #32861:
URL: https://github.com/apache/spark/pull/32861#discussion_r662501158
##########
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)
+ val sparkPlan = adaptivePlan.context.session.sessionState.planner.
+ plan(ReturnAnswer(optimized)).next()
Review comment:
Shall we just call `QueryExecution.createSparkPlan`?
--
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]