Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix bug where AQE does not respect entirePlanWillNotWork #6250

Merged
merged 2 commits into from
Aug 9, 2022
Merged
Changes from all commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,10 @@ abstract class RapidsMeta[INPUT <: BASE, BASE, OUTPUT <: BASE](
*/
final def entirePlanWillNotWork(because: String): Unit = {
cannotReplaceAnyOfPlanReasons.get.add(because)
// recursively tag the plan so that AQE does not attempt
// to run any of the child query stages on the GPU
willNotWorkOnGpu(because)
childPlans.foreach(_.entirePlanWillNotWork(because))
}

final def shouldBeRemoved(because: String): Unit =
Expand Down Expand Up @@ -229,8 +233,8 @@ abstract class RapidsMeta[INPUT <: BASE, BASE, OUTPUT <: BASE](
* set means the entire plan is ok to be replaced, do the normal checking
* per exec and children.
*/
final def entirePlanExcludedReasons: Seq[String] = {
cannotReplaceAnyOfPlanReasons.getOrElse(mutable.Set.empty).toSeq
final def entirePlanExcludedReasons: Set[String] = {
cannotReplaceAnyOfPlanReasons.getOrElse(mutable.Set.empty).toSet
}

/**
Expand Down Expand Up @@ -609,7 +613,7 @@ abstract class SparkPlanMeta[INPUT <: SparkPlan](plan: INPUT,
wrapped.withNewChildren(childPlans.map(_.convertIfNeeded()))
}

def getReasonsNotToReplaceEntirePlan: Seq[String] = {
def getReasonsNotToReplaceEntirePlan: Set[String] = {
val childReasons = childPlans.flatMap(_.getReasonsNotToReplaceEntirePlan)
entirePlanExcludedReasons ++ childReasons
}
Expand Down