Skip to content

Conversation

@cloud-fan
Copy link
Contributor

@cloud-fan cloud-fan commented Feb 4, 2020

What changes were proposed in this pull request?

Update InsertAdaptiveSparkPlan to not log warning if AQE is skipped intentionally.

This PR also add a config to not skip AQE.

Why are the changes needed?

It's not a warning at all if we intentionally skip AQE.

Does this PR introduce any user-facing change?

no

How was this patch tested?

run AdaptiveQueryExecSuite locally and verify that there is no warning logs.

@cloud-fan
Copy link
Contributor Author

cc @maryannxue @JkSelf

val ADAPTIVE_EXECUTION_FORCE_APPLY = buildConf("spark.sql.adaptive.forceApply")
.internal()
.doc("Adaptive query execution is skipped when the query does not have exchanges or " +
"subqueries. By setting this config to true, Spark will be forced to apply adaptive " +
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: Spark will force apply adaptive query execution for all supported queries.

// only know if the query may contain exchange or not by checking
// `SparkPlan.requiredChildDistribution`.
// - The query contains sub-query.
private def shouldApplyAQE(plan: SparkPlan, isSubquery: Boolean): Boolean = {
Copy link
Contributor

Choose a reason for hiding this comment

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

How about we just move the logic of mayContainExchange and containSubquery here and get rid of those methods?

// `SparkPlan.requiredChildDistribution`.
// - The query contains sub-query.
private def shouldApplyAQE(plan: SparkPlan, isSubquery: Boolean): Boolean = {
conf.getConf(SQLConf.ADAPTIVE_EXECUTION_FORCE_APPLY) || isSubquery ||
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: we could move conf.adaptiveExecutionEnabled here too.

@SparkQA
Copy link

SparkQA commented Feb 4, 2020

Test build #117833 has finished for PR 27452 at commit fb89132.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

Copy link
Contributor

@maryannxue maryannxue left a comment

Choose a reason for hiding this comment

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

LGTM

@SparkQA
Copy link

SparkQA commented Feb 5, 2020

Test build #117895 has finished for PR 27452 at commit 215435d.

  • This patch fails due to an unknown error code, -9.
  • This patch merges cleanly.
  • This patch adds no public classes.

@SparkQA
Copy link

SparkQA commented Feb 5, 2020

Test build #117884 has finished for PR 27452 at commit 841273e.

  • This patch fails due to an unknown error code, -9.
  • This patch merges cleanly.
  • This patch adds no public classes.

@JkSelf
Copy link
Contributor

JkSelf commented Feb 5, 2020

LGTM.

@JkSelf
Copy link
Contributor

JkSelf commented Feb 5, 2020

retest this please

@SparkQA
Copy link

SparkQA commented Feb 5, 2020

Test build #117917 has finished for PR 27452 at commit 215435d.

  • This patch fails Spark unit tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@cloud-fan
Copy link
Contributor Author

retest this please

@SparkQA
Copy link

SparkQA commented Feb 5, 2020

Test build #117931 has finished for PR 27452 at commit 215435d.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

.booleanConf
.createWithDefault(false)

val ADAPTIVE_EXECUTION_FORCE_APPLY = buildConf("spark.sql.adaptive.forceApply")
Copy link
Member

Choose a reason for hiding this comment

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

spark.sql.adaptive.forceApply.enabled?
cc @gatorsmile

Copy link
Contributor

Choose a reason for hiding this comment

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

No... that sounds weird.

Copy link
Member

Choose a reason for hiding this comment

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

@maryannxue . .enabled is a general guideline for boolean flag from @gatorsmile .

No... that sounds weird.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

it's usually xxx.featureName.enabled, but forceApply is a verb. For example, spark.sql.join.preferSortMergeJoin

Copy link
Member

Choose a reason for hiding this comment

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

Oh. Got it. I misunderstood the rule at that part until now. My bad. Thank you, @cloud-fan and @maryannxue .

Copy link
Contributor Author

Choose a reason for hiding this comment

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

do we have a policy that config name must be xxx.featureName.enabled? At least for internal configs we follow PR author's personal preference AFAIK.

Copy link
Member

Choose a reason for hiding this comment

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

We should then stop renaming the configurations to add .enabled (e.g., #27346, #27210, #26694). reuse, ignore, and fail can be a verb either.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@gatorsmile do we need to add ".enabled" post-fix to all boolean configs?

Copy link
Member

Choose a reason for hiding this comment

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

After this PR, it would be great if we have a documented policy for this, @gatorsmile and @cloud-fan .

Copy link
Member

Choose a reason for hiding this comment

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

Thank you for the references, @HyukjinKwon .

.internal()
.doc("Adaptive query execution is skipped when the query does not have exchanges or " +
"subqueries. By setting this config to true, Spark will force apply adaptive query " +
"execution for all supported queries.")
Copy link
Member

@dongjoon-hyun dongjoon-hyun Feb 5, 2020

Choose a reason for hiding this comment

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

To be clear, shall we mention like By setting both spark.sql.adaptive.enabled and this config to true,?

Copy link
Contributor

Choose a reason for hiding this comment

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

By setting this config (together with spark.sql.adaptive.enabled) to true

Copy link
Member

Choose a reason for hiding this comment

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

That sounds good.

Copy link
Member

@dongjoon-hyun dongjoon-hyun left a comment

Choose a reason for hiding this comment

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

@cloud-fan .
Could you revise the PR title? Currently, it looks like a warning suppression, but we are adding a new configuration spark.sql.adaptive.forceApply technically.

@cloud-fan cloud-fan changed the title [SPARK-30719][SQL] do not log warning if AQE is intentionally skipped [SPARK-30719][SQL] do not log warning if AQE is intentionally skipped and add a config to force apply Feb 6, 2020
@SparkQA
Copy link

SparkQA commented Feb 6, 2020

Test build #117975 has finished for PR 27452 at commit a796d19.

  • This patch fails Spark unit tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@cloud-fan
Copy link
Contributor Author

retest this please

@SparkQA
Copy link

SparkQA commented Feb 6, 2020

Test build #117982 has finished for PR 27452 at commit a796d19.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

// - The query may need to add exchanges. It's an overkill to run `EnsureRequirements` here, so
// we just check `SparkPlan.requiredChildDistribution` and see if it's possible that the
// the query needs to add exchanges later.
// - The query contains sub-query.
Copy link
Member

Choose a reason for hiding this comment

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

This is much clear than the original code.

Copy link
Member

@gatorsmile gatorsmile left a comment

Choose a reason for hiding this comment

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

@JkSelf Could you write a test suite to test whether we are correctly logging a warning?

@gatorsmile gatorsmile closed this in 8ce5862 Feb 6, 2020
gatorsmile pushed a commit that referenced this pull request Feb 6, 2020
… and add a config to force apply

### What changes were proposed in this pull request?

Update `InsertAdaptiveSparkPlan` to not log warning if AQE is skipped intentionally.

This PR also add a config to not skip AQE.

### Why are the changes needed?

It's not a warning at all if we intentionally skip AQE.

### Does this PR introduce any user-facing change?

no

### How was this patch tested?

run `AdaptiveQueryExecSuite` locally and verify that there is no warning logs.

Closes #27452 from cloud-fan/aqe.

Authored-by: Wenchen Fan <[email protected]>
Signed-off-by: Xiao Li <[email protected]>
(cherry picked from commit 8ce5862)
Signed-off-by: Xiao Li <[email protected]>
@gatorsmile
Copy link
Member

Thanks! Merged to master/3.0

@JkSelf
Copy link
Contributor

JkSelf commented Feb 10, 2020

@gatorsmile Add unit test in #27515.

cloud-fan pushed a commit that referenced this pull request Feb 10, 2020
… intentionally skip AQE

### What changes were proposed in this pull request?

This is a follow up in [#27452](#27452).
Add a unit test to verify whether the log warning is print when intentionally skip AQE.

### Why are the changes needed?

Add unit test

### Does this PR introduce any user-facing change?

No

### How was this patch tested?

adding unit test

Closes #27515 from JkSelf/aqeLoggingWarningTest.

Authored-by: jiake <[email protected]>
Signed-off-by: Wenchen Fan <[email protected]>
cloud-fan pushed a commit that referenced this pull request Feb 10, 2020
… intentionally skip AQE

### What changes were proposed in this pull request?

This is a follow up in [#27452](#27452).
Add a unit test to verify whether the log warning is print when intentionally skip AQE.

### Why are the changes needed?

Add unit test

### Does this PR introduce any user-facing change?

No

### How was this patch tested?

adding unit test

Closes #27515 from JkSelf/aqeLoggingWarningTest.

Authored-by: jiake <[email protected]>
Signed-off-by: Wenchen Fan <[email protected]>
(cherry picked from commit 5a24060)
Signed-off-by: Wenchen Fan <[email protected]>
sjincho pushed a commit to sjincho/spark that referenced this pull request Apr 15, 2020
… and add a config to force apply

### What changes were proposed in this pull request?

Update `InsertAdaptiveSparkPlan` to not log warning if AQE is skipped intentionally.

This PR also add a config to not skip AQE.

### Why are the changes needed?

It's not a warning at all if we intentionally skip AQE.

### Does this PR introduce any user-facing change?

no

### How was this patch tested?

run `AdaptiveQueryExecSuite` locally and verify that there is no warning logs.

Closes apache#27452 from cloud-fan/aqe.

Authored-by: Wenchen Fan <[email protected]>
Signed-off-by: Xiao Li <[email protected]>
sjincho pushed a commit to sjincho/spark that referenced this pull request Apr 15, 2020
… intentionally skip AQE

### What changes were proposed in this pull request?

This is a follow up in [apache#27452](apache#27452).
Add a unit test to verify whether the log warning is print when intentionally skip AQE.

### Why are the changes needed?

Add unit test

### Does this PR introduce any user-facing change?

No

### How was this patch tested?

adding unit test

Closes apache#27515 from JkSelf/aqeLoggingWarningTest.

Authored-by: jiake <[email protected]>
Signed-off-by: Wenchen Fan <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants