-
Notifications
You must be signed in to change notification settings - Fork 630
[GLUTEN-11635][FOLLOW-UP] Respect partial fallback configs when checking node support #11988
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
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -16,6 +16,8 @@ | |
| */ | ||
| package org.apache.gluten.extension | ||
|
|
||
| import org.apache.gluten.config.GlutenConfig | ||
|
|
||
| import org.apache.spark.sql.catalyst.rules.{Rule, RuleExecutor} | ||
| import org.apache.spark.sql.execution.{GenerateExec, ProjectExec, SparkPlan} | ||
| import org.apache.spark.sql.internal.SQLConf | ||
|
|
@@ -37,8 +39,9 @@ case class PartialFallbackRules() extends Rule[SparkPlan] { | |
| } | ||
|
|
||
| object PartialFallback { | ||
| def supportPartialFallback(plan: SparkPlan): Boolean = { | ||
| plan.isInstanceOf[ProjectExec] || | ||
| plan.isInstanceOf[GenerateExec] | ||
| def supportPartialFallback(plan: SparkPlan): Boolean = plan match { | ||
| case _: ProjectExec => GlutenConfig.get.enableColumnarPartialProject | ||
| case _: GenerateExec => GlutenConfig.get.enableColumnarPartialGenerate | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ditto. |
||
| case _ => false | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -162,14 +162,28 @@ class GlutenHiveUDFSuite extends GlutenQueryComparisonTest with SQLTestUtils { | |
| val plusOne = udf((x: Long) => x + 1) | ||
| spark.udf.register("plus_one", plusOne) | ||
| sql(s"CREATE TEMPORARY FUNCTION noInputUDTF AS '${classOf[NoInputUDTF].getName}'") | ||
| runQueryAndCompare(""" | ||
| |select plus_one(col1) as col2, l_partkey from ( | ||
| | select col1, l_partkey from lineitem lateral view noInputUDTF() as col1 | ||
| |)""".stripMargin) { | ||
| df => | ||
| { | ||
| checkOperatorMatch[ColumnarPartialProjectExec](df) | ||
| checkOperatorMatch[ColumnarPartialGenerateExec](df) | ||
|
|
||
| Seq(true, false).foreach { | ||
| enablePartialProject => | ||
| withSQLConf( | ||
| SQLConf.ANSI_ENABLED.key -> "false", | ||
| GlutenConfig.ENABLE_COLUMNAR_PARTIAL_PROJECT.key -> enablePartialProject.toString) { | ||
| runQueryAndCompare( | ||
| """ | ||
| |select plus_one(col1) as col2, l_partkey from ( | ||
| | select col1, l_partkey from lineitem lateral view noInputUDTF() as col1 | ||
| |)""".stripMargin, | ||
| noFallBack = enablePartialProject | ||
| ) { | ||
| df => | ||
| val executedPlan = getExecutedPlan(df) | ||
| assert( | ||
| executedPlan.exists(_.isInstanceOf[ColumnarPartialProjectExec]) == | ||
| enablePartialProject) | ||
| assert( | ||
| executedPlan.exists(_.isInstanceOf[ColumnarPartialGenerateExec]) == | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we also test the case that ENABLE_COLUMNAR_PARTIAL_GENERATE is disabled?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done. |
||
| enablePartialProject) | ||
| } | ||
| } | ||
| } | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I noticed the following code already performs this check before PartialFallback.supportPartialFallback is called. Is this a duplicate?
gluten/backends-velox/src/main/scala/org/apache/gluten/extension/PartialProjectRule.scala
Line 28 in f0a3df8
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is to handle situations where the parent and child are different; one is ProjectExec, and the other is GenerateExec.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I meant the check for config. Am I missing something?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The rule-level check only controls whether that specific rule runs.
supportPartialFallbackis used when checking whether a parent SparkPlan can be used as a partial-fallback boundary by another rule.In nested cases,
PartialGenerateRulemay inspect aProjectExecparent, andPartialProjectRulemay inspect aGenerateExecparent. Without checking the corresponding config insupportPartialFallback, a disabled partial fallback type can still be considered a supported boundary indirectly.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see. It's cross referenced. Thanks.