Skip to content
This repository has been archived by the owner on Sep 18, 2023. It is now read-only.

[NSE-947] Add a whole stage fallback strategy #948

Merged
merged 12 commits into from
Sep 8, 2022

Conversation

PHILO-HE
Copy link
Collaborator

@PHILO-HE PHILO-HE commented Jun 1, 2022

What changes were proposed in this pull request?

Let whole stage fallback if there would be 3 or more fallbacks in a stage.

How was this patch tested?

UT.

@github-actions
Copy link

github-actions bot commented Jun 1, 2022

#947

@PHILO-HE PHILO-HE marked this pull request as draft June 2, 2022 03:16
@PHILO-HE PHILO-HE force-pushed the fallback-strategy branch 2 times, most recently from 15c04f6 to e75e7d4 Compare June 8, 2022 14:24
@PHILO-HE PHILO-HE marked this pull request as ready for review July 18, 2022 06:28
}
isLeafPlanExchange || (SQLConf.get.adaptiveExecutionEnabled && (sanityCheck(plan) &&
!plan.logicalLink.exists(_.isStreaming) &&
!plan.expressions.exists(_.find(_.isInstanceOf[DynamicPruningSubquery]).isDefined) &&
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This part of code is ported from spark's source code. From spark 3.2, DPP can be coexisted with AQE, so the below statement should be removed for spark 3.2. We differentiated the implementation in shim layers.

!plan.expressions.exists(_.find(_.isInstanceOf[DynamicPruningSubquery]).isDefined

def supportAdaptive(plan: SparkPlan): Boolean

def supportAdaptiveWithExchangeConsidered(plan: SparkPlan): Boolean = {
isLeafPlanExchange(plan) || supportAdaptive(plan)
Copy link
Collaborator Author

@PHILO-HE PHILO-HE Jul 18, 2022

Choose a reason for hiding this comment

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

It looks isLeafPlanExchange should not be checked recursively. So we moved it from #supportAdaptive.
Such handling can fix issues for tpc-ds q23b in spark 3.1, where the code wrongly judges that AQE is supported.

/**
* Ported from InsertAdaptiveSparkPlan.
*/
override def supportAdaptive(plan: SparkPlan): Boolean = {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Consistent with spark 3.1 source code.

/**
* Ported from InsertAdaptiveSparkPlan.
*/
override def supportAdaptive(plan: SparkPlan): Boolean = {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Consistent with spark 3.2 source code.

@zhouyuan zhouyuan merged commit 890df14 into oap-project:main Sep 8, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants