Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
address comment
  • Loading branch information
ulysses-you committed May 5, 2023
commit 8a41b7a768c37e1ebb76be4854def1bcdc5d903b
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ case class ReuseAdaptiveSubquery(

plan.transformAllExpressionsWithPruning(_.containsPattern(PLAN_EXPRESSION)) {
case sub: ExecSubqueryExpression =>
// `InsertAdaptiveSparkPlan` compiles subquery for each exprId, then the java object
// is always `eq` if two subqueries have same exprId.
// Check if the subquery can be reused manually instead of call `getOrElseUpdate`.
// The subquery can be already reused (the same Java object) due to filter pushdown
// of table cache. If it happens, we just need to wrap the current subquery with
// `ReusedSubqueryExec` and no need to update the `reuseMap`.
reuseMap.get(sub.plan.canonicalized).map { subquery =>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just noticed that this rule is not idempotent now. If we run it twice, then all subqueries will become ReusedSubqueryExec because all subqueries are in the reuseMap.

sub.withNewPlan(ReusedSubqueryExec(subquery))
}.getOrElse {
Expand Down