You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@gluten.apache.org by "beliefer (via GitHub)" <gi...@apache.org> on 2024/09/26 09:41:54 UTC
[PR] [GLUTEN-7364] Simplify the RuleInjector [incubator-gluten]
beliefer opened a new pull request, #7365:
URL: https://github.com/apache/incubator-gluten/pull/7365
## What changes were proposed in this pull request?
This PR proposes to simplify the `RuleInjector`.
The change increases the readability and more clear.
In fact, we can remove the `SparkInjector`, but I suspect it already became the public API.
## How was this patch tested?
integration tests
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@gluten.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@gluten.apache.org
For additional commands, e-mail: commits-help@gluten.apache.org
Re: [PR] [GLUTEN-7364][CORE] Simplify the RuleInjector [incubator-gluten]
Posted by "beliefer (via GitHub)" <gi...@apache.org>.
beliefer commented on code in PR #7365:
URL: https://github.com/apache/incubator-gluten/pull/7365#discussion_r1779832453
##########
gluten-core/src/main/scala/org/apache/gluten/extension/injector/RuleInjector.scala:
##########
@@ -19,12 +19,12 @@ package org.apache.gluten.extension.injector
import org.apache.spark.sql.SparkSessionExtensions
/** Injector used to inject query planner rules into Spark and Gluten. */
-class RuleInjector {
- val spark: SparkInjector = new SparkInjector()
+class RuleInjector(val extensions: SparkSessionExtensions) {
Review Comment:
In the world of Spark, `spark` usually means to SparkSession.
For consistent, let's use `extensions`.
##########
gluten-core/src/main/scala/org/apache/gluten/extension/injector/RuleInjector.scala:
##########
@@ -19,12 +19,12 @@ package org.apache.gluten.extension.injector
import org.apache.spark.sql.SparkSessionExtensions
/** Injector used to inject query planner rules into Spark and Gluten. */
-class RuleInjector {
- val spark: SparkInjector = new SparkInjector()
+class RuleInjector(val extensions: SparkSessionExtensions) {
Review Comment:
In the world of Spark, `spark` usually means `SparkSession`.
For consistent, let's use `extensions`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@gluten.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@gluten.apache.org
For additional commands, e-mail: commits-help@gluten.apache.org
Re: [PR] [GLUTEN-7364][CORE] Simplify the RuleInjector [incubator-gluten]
Posted by "zhztheplayer (via GitHub)" <gi...@apache.org>.
zhztheplayer commented on code in PR #7365:
URL: https://github.com/apache/incubator-gluten/pull/7365#discussion_r1777972412
##########
gluten-core/src/main/scala/org/apache/gluten/extension/injector/SparkInjector.scala:
##########
@@ -16,68 +16,8 @@
*/
package org.apache.gluten.extension.injector
-import org.apache.spark.sql.{SparkSession, SparkSessionExtensions, Strategy}
-import org.apache.spark.sql.catalyst.FunctionIdentifier
-import org.apache.spark.sql.catalyst.analysis.FunctionRegistry.FunctionBuilder
-import org.apache.spark.sql.catalyst.expressions.ExpressionInfo
-import org.apache.spark.sql.catalyst.parser.ParserInterface
-import org.apache.spark.sql.catalyst.plans.logical.LogicalPlan
-import org.apache.spark.sql.catalyst.rules.Rule
-import org.apache.spark.sql.execution.SparkPlan
-
-import scala.collection.mutable
+import org.apache.spark.sql.SparkSessionExtensions
/** Injector used to inject query planner rules into Spark. */
-class SparkInjector private[injector] {
- private type RuleBuilder = SparkSession => Rule[LogicalPlan]
- private type StrategyBuilder = SparkSession => Strategy
- private type ParserBuilder = (SparkSession, ParserInterface) => ParserInterface
- private type FunctionDescription = (FunctionIdentifier, ExpressionInfo, FunctionBuilder)
- private type QueryStagePrepRuleBuilder = SparkSession => Rule[SparkPlan]
-
- private val queryStagePrepRuleBuilders = mutable.Buffer.empty[QueryStagePrepRuleBuilder]
- private val parserBuilders = mutable.Buffer.empty[ParserBuilder]
- private val resolutionRuleBuilders = mutable.Buffer.empty[RuleBuilder]
- private val optimizerRules = mutable.Buffer.empty[RuleBuilder]
- private val plannerStrategyBuilders = mutable.Buffer.empty[StrategyBuilder]
- private val injectedFunctions = mutable.Buffer.empty[FunctionDescription]
- private val postHocResolutionRuleBuilders = mutable.Buffer.empty[RuleBuilder]
-
- def injectQueryStagePrepRule(builder: QueryStagePrepRuleBuilder): Unit = {
- queryStagePrepRuleBuilders += builder
- }
-
- def injectParser(builder: ParserBuilder): Unit = {
- parserBuilders += builder
- }
-
- def injectResolutionRule(builder: RuleBuilder): Unit = {
- resolutionRuleBuilders += builder
- }
-
- def injectOptimizerRule(builder: RuleBuilder): Unit = {
- optimizerRules += builder
- }
-
- def injectPlannerStrategy(builder: StrategyBuilder): Unit = {
- plannerStrategyBuilders += builder
- }
-
- def injectFunction(functionDescription: FunctionDescription): Unit = {
- injectedFunctions += functionDescription
- }
-
- def injectPostHocResolutionRule(builder: RuleBuilder): Unit = {
- postHocResolutionRuleBuilders += builder
- }
-
- private[injector] def inject(extensions: SparkSessionExtensions): Unit = {
- queryStagePrepRuleBuilders.foreach(extensions.injectQueryStagePrepRule)
- parserBuilders.foreach(extensions.injectParser)
- resolutionRuleBuilders.foreach(extensions.injectResolutionRule)
- optimizerRules.foreach(extensions.injectOptimizerRule)
- plannerStrategyBuilders.foreach(extensions.injectPlannerStrategy)
- injectedFunctions.foreach(extensions.injectFunction)
- postHocResolutionRuleBuilders.foreach(extensions.injectPostHocResolutionRule)
- }
-}
+@deprecated("This class is deprecated and will be removed in future versions.", since = "1.3.0")
+class SparkInjector private[injector] (val extensions: SparkSessionExtensions) {}
Review Comment:
I think we can just remove minor unused APIs like this one, as Gluten doesn't officially guarantee API level backward compatibility yet.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@gluten.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@gluten.apache.org
For additional commands, e-mail: commits-help@gluten.apache.org
Re: [PR] [GLUTEN-7364][CORE] Simplify the RuleInjector [incubator-gluten]
Posted by "beliefer (via GitHub)" <gi...@apache.org>.
beliefer commented on PR #7365:
URL: https://github.com/apache/incubator-gluten/pull/7365#issuecomment-2381073126
> > But `SparkInjector` only copy the API from `SparkSessionExtensions`, so this PR doesn't change the `GlutenInjector` and only remove the `SparkInjector`. This PR doesn't break what the Gluten want.
>
> I meant after the PR, developer could use API `injector.extensions.injectColumnar` to inject another `ColumnarRule` in `VeloxRuleApi` / `CHRuleAPI`, since we expose `SparkSessionExtensions` to developer. Before this PR, one cannot access `SparkSessionExtensions` in `VeloxRuleApi` / `CHRuleAPI`. Just to make sure we are on the same page here.
Got it. We can reserve the `SparkInjector`. Let me refactor it.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@gluten.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@gluten.apache.org
For additional commands, e-mail: commits-help@gluten.apache.org
Re: [PR] [GLUTEN-7364][VL][CH] Simplify the RuleInjector [incubator-gluten]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #7365:
URL: https://github.com/apache/incubator-gluten/pull/7365#issuecomment-2376474642
Run Gluten Clickhouse CI
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@gluten.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@gluten.apache.org
For additional commands, e-mail: commits-help@gluten.apache.org
Re: [PR] [GLUTEN-7364][VL][CH] Simplify the RuleInjector [incubator-gluten]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #7365:
URL: https://github.com/apache/incubator-gluten/pull/7365#issuecomment-2376578194
Run Gluten Clickhouse CI
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@gluten.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@gluten.apache.org
For additional commands, e-mail: commits-help@gluten.apache.org
Re: [PR] [GLUTEN-7364][CORE] Simplify the RuleInjector [incubator-gluten]
Posted by "beliefer (via GitHub)" <gi...@apache.org>.
beliefer commented on PR #7365:
URL: https://github.com/apache/incubator-gluten/pull/7365#issuecomment-2378247418
ping @zhouyuan @zzcclp @liuneng1994
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@gluten.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@gluten.apache.org
For additional commands, e-mail: commits-help@gluten.apache.org
Re: [PR] [GLUTEN-7364][CORE] Simplify the RuleInjector [incubator-gluten]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #7365:
URL: https://github.com/apache/incubator-gluten/pull/7365#issuecomment-2378389954
Run Gluten Clickhouse CI
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@gluten.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@gluten.apache.org
For additional commands, e-mail: commits-help@gluten.apache.org
Re: [PR] [GLUTEN-7364][CORE] Simplify the RuleInjector [incubator-gluten]
Posted by "zhztheplayer (via GitHub)" <gi...@apache.org>.
zhztheplayer commented on code in PR #7365:
URL: https://github.com/apache/incubator-gluten/pull/7365#discussion_r1777973025
##########
gluten-core/src/main/scala/org/apache/gluten/extension/injector/RuleInjector.scala:
##########
@@ -19,12 +19,13 @@ package org.apache.gluten.extension.injector
import org.apache.spark.sql.SparkSessionExtensions
/** Injector used to inject query planner rules into Spark and Gluten. */
-class RuleInjector {
- val spark: SparkInjector = new SparkInjector()
+class RuleInjector(extensions: SparkSessionExtensions) {
+ val spark: SparkInjector = new SparkInjector(extensions)
val gluten: GlutenInjector = new GlutenInjector()
private[extension] def inject(extensions: SparkSessionExtensions): Unit = {
- spark.inject(extensions)
+ // The regular Spark rules already injected with the `injectRules` of `RuleApi` directly.
+ // Only inject the Spark columnar rule here.
gluten.inject(extensions)
}
Review Comment:
Both constructor and method `#inject` accepts a `extensions: SparkSessionExtensions`. Can we remove the one in `#inject`?
##########
gluten-core/src/main/scala/org/apache/gluten/extension/injector/SparkInjector.scala:
##########
@@ -16,68 +16,8 @@
*/
package org.apache.gluten.extension.injector
-import org.apache.spark.sql.{SparkSession, SparkSessionExtensions, Strategy}
-import org.apache.spark.sql.catalyst.FunctionIdentifier
-import org.apache.spark.sql.catalyst.analysis.FunctionRegistry.FunctionBuilder
-import org.apache.spark.sql.catalyst.expressions.ExpressionInfo
-import org.apache.spark.sql.catalyst.parser.ParserInterface
-import org.apache.spark.sql.catalyst.plans.logical.LogicalPlan
-import org.apache.spark.sql.catalyst.rules.Rule
-import org.apache.spark.sql.execution.SparkPlan
-
-import scala.collection.mutable
+import org.apache.spark.sql.SparkSessionExtensions
/** Injector used to inject query planner rules into Spark. */
-class SparkInjector private[injector] {
- private type RuleBuilder = SparkSession => Rule[LogicalPlan]
- private type StrategyBuilder = SparkSession => Strategy
- private type ParserBuilder = (SparkSession, ParserInterface) => ParserInterface
- private type FunctionDescription = (FunctionIdentifier, ExpressionInfo, FunctionBuilder)
- private type QueryStagePrepRuleBuilder = SparkSession => Rule[SparkPlan]
-
- private val queryStagePrepRuleBuilders = mutable.Buffer.empty[QueryStagePrepRuleBuilder]
- private val parserBuilders = mutable.Buffer.empty[ParserBuilder]
- private val resolutionRuleBuilders = mutable.Buffer.empty[RuleBuilder]
- private val optimizerRules = mutable.Buffer.empty[RuleBuilder]
- private val plannerStrategyBuilders = mutable.Buffer.empty[StrategyBuilder]
- private val injectedFunctions = mutable.Buffer.empty[FunctionDescription]
- private val postHocResolutionRuleBuilders = mutable.Buffer.empty[RuleBuilder]
-
- def injectQueryStagePrepRule(builder: QueryStagePrepRuleBuilder): Unit = {
- queryStagePrepRuleBuilders += builder
- }
-
- def injectParser(builder: ParserBuilder): Unit = {
- parserBuilders += builder
- }
-
- def injectResolutionRule(builder: RuleBuilder): Unit = {
- resolutionRuleBuilders += builder
- }
-
- def injectOptimizerRule(builder: RuleBuilder): Unit = {
- optimizerRules += builder
- }
-
- def injectPlannerStrategy(builder: StrategyBuilder): Unit = {
- plannerStrategyBuilders += builder
- }
-
- def injectFunction(functionDescription: FunctionDescription): Unit = {
- injectedFunctions += functionDescription
- }
-
- def injectPostHocResolutionRule(builder: RuleBuilder): Unit = {
- postHocResolutionRuleBuilders += builder
- }
-
- private[injector] def inject(extensions: SparkSessionExtensions): Unit = {
- queryStagePrepRuleBuilders.foreach(extensions.injectQueryStagePrepRule)
- parserBuilders.foreach(extensions.injectParser)
- resolutionRuleBuilders.foreach(extensions.injectResolutionRule)
- optimizerRules.foreach(extensions.injectOptimizerRule)
- plannerStrategyBuilders.foreach(extensions.injectPlannerStrategy)
- injectedFunctions.foreach(extensions.injectFunction)
- postHocResolutionRuleBuilders.foreach(extensions.injectPostHocResolutionRule)
- }
-}
+@deprecated("This class is deprecated and will be removed in future versions.", since = "1.3.0")
+class SparkInjector private[injector] (val extensions: SparkSessionExtensions) {}
Review Comment:
I think we can just remove minor unused APIs like this one, as Gluten doesn't officially guarantee backward compatibility yet.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@gluten.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@gluten.apache.org
For additional commands, e-mail: commits-help@gluten.apache.org
Re: [PR] [GLUTEN-7364][CORE] Simplify the RuleInjector [incubator-gluten]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #7365:
URL: https://github.com/apache/incubator-gluten/pull/7365#issuecomment-2379151193
Run Gluten Clickhouse CI
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@gluten.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@gluten.apache.org
For additional commands, e-mail: commits-help@gluten.apache.org
Re: [PR] [GLUTEN-7364] Simplify the RuleInjector [incubator-gluten]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #7365:
URL: https://github.com/apache/incubator-gluten/pull/7365#issuecomment-2376460261
Run Gluten Clickhouse CI
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@gluten.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@gluten.apache.org
For additional commands, e-mail: commits-help@gluten.apache.org
Re: [PR] [GLUTEN-7364] Simplify the RuleInjector [incubator-gluten]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #7365:
URL: https://github.com/apache/incubator-gluten/pull/7365#issuecomment-2376459932
https://github.com/apache/incubator-gluten/issues/7364
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@gluten.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@gluten.apache.org
For additional commands, e-mail: commits-help@gluten.apache.org
Re: [PR] [GLUTEN-7364][CORE] Simplify the RuleInjector [incubator-gluten]
Posted by "beliefer (via GitHub)" <gi...@apache.org>.
beliefer commented on code in PR #7365:
URL: https://github.com/apache/incubator-gluten/pull/7365#discussion_r1777985261
##########
gluten-core/src/main/scala/org/apache/gluten/extension/injector/SparkInjector.scala:
##########
@@ -16,68 +16,8 @@
*/
package org.apache.gluten.extension.injector
-import org.apache.spark.sql.{SparkSession, SparkSessionExtensions, Strategy}
-import org.apache.spark.sql.catalyst.FunctionIdentifier
-import org.apache.spark.sql.catalyst.analysis.FunctionRegistry.FunctionBuilder
-import org.apache.spark.sql.catalyst.expressions.ExpressionInfo
-import org.apache.spark.sql.catalyst.parser.ParserInterface
-import org.apache.spark.sql.catalyst.plans.logical.LogicalPlan
-import org.apache.spark.sql.catalyst.rules.Rule
-import org.apache.spark.sql.execution.SparkPlan
-
-import scala.collection.mutable
+import org.apache.spark.sql.SparkSessionExtensions
/** Injector used to inject query planner rules into Spark. */
-class SparkInjector private[injector] {
- private type RuleBuilder = SparkSession => Rule[LogicalPlan]
- private type StrategyBuilder = SparkSession => Strategy
- private type ParserBuilder = (SparkSession, ParserInterface) => ParserInterface
- private type FunctionDescription = (FunctionIdentifier, ExpressionInfo, FunctionBuilder)
- private type QueryStagePrepRuleBuilder = SparkSession => Rule[SparkPlan]
-
- private val queryStagePrepRuleBuilders = mutable.Buffer.empty[QueryStagePrepRuleBuilder]
- private val parserBuilders = mutable.Buffer.empty[ParserBuilder]
- private val resolutionRuleBuilders = mutable.Buffer.empty[RuleBuilder]
- private val optimizerRules = mutable.Buffer.empty[RuleBuilder]
- private val plannerStrategyBuilders = mutable.Buffer.empty[StrategyBuilder]
- private val injectedFunctions = mutable.Buffer.empty[FunctionDescription]
- private val postHocResolutionRuleBuilders = mutable.Buffer.empty[RuleBuilder]
-
- def injectQueryStagePrepRule(builder: QueryStagePrepRuleBuilder): Unit = {
- queryStagePrepRuleBuilders += builder
- }
-
- def injectParser(builder: ParserBuilder): Unit = {
- parserBuilders += builder
- }
-
- def injectResolutionRule(builder: RuleBuilder): Unit = {
- resolutionRuleBuilders += builder
- }
-
- def injectOptimizerRule(builder: RuleBuilder): Unit = {
- optimizerRules += builder
- }
-
- def injectPlannerStrategy(builder: StrategyBuilder): Unit = {
- plannerStrategyBuilders += builder
- }
-
- def injectFunction(functionDescription: FunctionDescription): Unit = {
- injectedFunctions += functionDescription
- }
-
- def injectPostHocResolutionRule(builder: RuleBuilder): Unit = {
- postHocResolutionRuleBuilders += builder
- }
-
- private[injector] def inject(extensions: SparkSessionExtensions): Unit = {
- queryStagePrepRuleBuilders.foreach(extensions.injectQueryStagePrepRule)
- parserBuilders.foreach(extensions.injectParser)
- resolutionRuleBuilders.foreach(extensions.injectResolutionRule)
- optimizerRules.foreach(extensions.injectOptimizerRule)
- plannerStrategyBuilders.foreach(extensions.injectPlannerStrategy)
- injectedFunctions.foreach(extensions.injectFunction)
- postHocResolutionRuleBuilders.foreach(extensions.injectPostHocResolutionRule)
- }
-}
+@deprecated("This class is deprecated and will be removed in future versions.", since = "1.3.0")
+class SparkInjector private[injector] (val extensions: SparkSessionExtensions) {}
Review Comment:
As expected.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@gluten.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@gluten.apache.org
For additional commands, e-mail: commits-help@gluten.apache.org
Re: [PR] [GLUTEN-7364][CORE] Simplify the RuleInjector [incubator-gluten]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #7365:
URL: https://github.com/apache/incubator-gluten/pull/7365#issuecomment-2381054909
Run Gluten Clickhouse CI
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@gluten.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@gluten.apache.org
For additional commands, e-mail: commits-help@gluten.apache.org
Re: [PR] [GLUTEN-7364][CORE] Simplify the RuleInjector [incubator-gluten]
Posted by "zhztheplayer (via GitHub)" <gi...@apache.org>.
zhztheplayer commented on PR #7365:
URL: https://github.com/apache/incubator-gluten/pull/7365#issuecomment-2381057756
> But `SparkInjector` only copy the API from `SparkSessionExtensions`, so this PR doesn't change the `GlutenInjector` and only remove the `SparkInjector`. This PR doesn't break what the Gluten want.
I meant after the PR, developer could use API `injector.extensions.injectColumnar` to inject another `ColumnarRule` in `VeloxRuleApi` / `CHRuleAPI`, since we expose `SparkSessionExtensions` to developer. Before this PR, one cannot access `SparkSessionExtensions` in `VeloxRuleApi` / `CHRuleAPI`. Just to make sure we are on the same page here.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@gluten.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@gluten.apache.org
For additional commands, e-mail: commits-help@gluten.apache.org
Re: [PR] [GLUTEN-7364][CORE] Simplify the RuleInjector [incubator-gluten]
Posted by "beliefer (via GitHub)" <gi...@apache.org>.
beliefer commented on PR #7365:
URL: https://github.com/apache/incubator-gluten/pull/7365#issuecomment-2381046816
@zhztheplayer Please review again! Thank you.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@gluten.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@gluten.apache.org
For additional commands, e-mail: commits-help@gluten.apache.org
Re: [PR] [GLUTEN-7364][CORE] Simplify the RuleInjector [incubator-gluten]
Posted by "beliefer (via GitHub)" <gi...@apache.org>.
beliefer commented on PR #7365:
URL: https://github.com/apache/incubator-gluten/pull/7365#issuecomment-2378308905
cc @zhztheplayer @FelixYBW
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@gluten.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@gluten.apache.org
For additional commands, e-mail: commits-help@gluten.apache.org
Re: [PR] [GLUTEN-7364][CORE] Simplify the RuleInjector [incubator-gluten]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #7365:
URL: https://github.com/apache/incubator-gluten/pull/7365#issuecomment-2379067478
Run Gluten Clickhouse CI
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@gluten.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@gluten.apache.org
For additional commands, e-mail: commits-help@gluten.apache.org
Re: [PR] [GLUTEN-7364][VL][CH] Simplify the RuleInjector [incubator-gluten]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #7365:
URL: https://github.com/apache/incubator-gluten/pull/7365#issuecomment-2376523560
Run Gluten Clickhouse CI
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@gluten.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@gluten.apache.org
For additional commands, e-mail: commits-help@gluten.apache.org
Re: [PR] [GLUTEN-7364][VL][CH] Simplify the RuleInjector [incubator-gluten]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #7365:
URL: https://github.com/apache/incubator-gluten/pull/7365#issuecomment-2376620398
Run Gluten Clickhouse CI
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@gluten.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@gluten.apache.org
For additional commands, e-mail: commits-help@gluten.apache.org
Re: [PR] [GLUTEN-7364][CORE] Simplify the RuleInjector [incubator-gluten]
Posted by "beliefer (via GitHub)" <gi...@apache.org>.
beliefer commented on code in PR #7365:
URL: https://github.com/apache/incubator-gluten/pull/7365#discussion_r1779842224
##########
backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxRuleApi.scala:
##########
@@ -38,18 +38,18 @@ class VeloxRuleApi extends RuleApi {
override def injectRules(injector: RuleInjector): Unit = {
injector.gluten.skipOn(PhysicalPlanSelector.skipCond)
- injectSpark(injector.spark)
+ injectSpark(injector)
injectLegacy(injector.gluten.legacy)
injectRas(injector.gluten.ras)
}
}
private object VeloxRuleApi {
- def injectSpark(injector: SparkInjector): Unit = {
- // Regular Spark rules.
- injector.injectOptimizerRule(CollectRewriteRule.apply)
- injector.injectOptimizerRule(HLLRewriteRule.apply)
- injector.injectPostHocResolutionRule(ArrowConvertorRule.apply)
+ def injectSpark(injector: RuleInjector): Unit = {
Review Comment:
How about `extensions`?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@gluten.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@gluten.apache.org
For additional commands, e-mail: commits-help@gluten.apache.org
Re: [PR] [GLUTEN-7364][CORE] Simplify the RuleInjector [incubator-gluten]
Posted by "beliefer (via GitHub)" <gi...@apache.org>.
beliefer commented on code in PR #7365:
URL: https://github.com/apache/incubator-gluten/pull/7365#discussion_r1779832453
##########
gluten-core/src/main/scala/org/apache/gluten/extension/injector/RuleInjector.scala:
##########
@@ -19,12 +19,12 @@ package org.apache.gluten.extension.injector
import org.apache.spark.sql.SparkSessionExtensions
/** Injector used to inject query planner rules into Spark and Gluten. */
-class RuleInjector {
- val spark: SparkInjector = new SparkInjector()
+class RuleInjector(val extensions: SparkSessionExtensions) {
Review Comment:
In the world of Spark, Spark usually means to SparkSession.
For consistent, let's use `exts`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@gluten.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@gluten.apache.org
For additional commands, e-mail: commits-help@gluten.apache.org
Re: [PR] [GLUTEN-7364][VL][CH] Simplify the RuleInjector [incubator-gluten]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #7365:
URL: https://github.com/apache/incubator-gluten/pull/7365#issuecomment-2376489365
Run Gluten Clickhouse CI
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@gluten.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@gluten.apache.org
For additional commands, e-mail: commits-help@gluten.apache.org
Re: [PR] [GLUTEN-7364][CORE] Simplify the RuleInjector [incubator-gluten]
Posted by "beliefer (via GitHub)" <gi...@apache.org>.
beliefer commented on code in PR #7365:
URL: https://github.com/apache/incubator-gluten/pull/7365#discussion_r1778000735
##########
gluten-core/src/main/scala/org/apache/gluten/extension/injector/RuleInjector.scala:
##########
@@ -19,12 +19,13 @@ package org.apache.gluten.extension.injector
import org.apache.spark.sql.SparkSessionExtensions
/** Injector used to inject query planner rules into Spark and Gluten. */
-class RuleInjector {
- val spark: SparkInjector = new SparkInjector()
+class RuleInjector(extensions: SparkSessionExtensions) {
+ val spark: SparkInjector = new SparkInjector(extensions)
val gluten: GlutenInjector = new GlutenInjector()
private[extension] def inject(extensions: SparkSessionExtensions): Unit = {
- spark.inject(extensions)
+ // The regular Spark rules already injected with the `injectRules` of `RuleApi` directly.
+ // Only inject the Spark columnar rule here.
gluten.inject(extensions)
}
Review Comment:
updated.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@gluten.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@gluten.apache.org
For additional commands, e-mail: commits-help@gluten.apache.org
Re: [PR] [GLUTEN-7364][CORE] Simplify the RuleInjector [incubator-gluten]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #7365:
URL: https://github.com/apache/incubator-gluten/pull/7365#issuecomment-2380605358
Run Gluten Clickhouse CI
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@gluten.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@gluten.apache.org
For additional commands, e-mail: commits-help@gluten.apache.org
Re: [PR] [GLUTEN-7364][CORE] Simplify the RuleInjector [incubator-gluten]
Posted by "zhztheplayer (via GitHub)" <gi...@apache.org>.
zhztheplayer commented on code in PR #7365:
URL: https://github.com/apache/incubator-gluten/pull/7365#discussion_r1779825368
##########
gluten-core/src/main/scala/org/apache/gluten/extension/injector/RuleInjector.scala:
##########
@@ -19,12 +19,12 @@ package org.apache.gluten.extension.injector
import org.apache.spark.sql.SparkSessionExtensions
/** Injector used to inject query planner rules into Spark and Gluten. */
-class RuleInjector {
- val spark: SparkInjector = new SparkInjector()
+class RuleInjector(val extensions: SparkSessionExtensions) {
Review Comment:
```suggestion
class RuleInjector(val spark: SparkSessionExtensions) {
```
##########
backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxRuleApi.scala:
##########
@@ -38,18 +38,18 @@ class VeloxRuleApi extends RuleApi {
override def injectRules(injector: RuleInjector): Unit = {
injector.gluten.skipOn(PhysicalPlanSelector.skipCond)
- injectSpark(injector.spark)
+ injectSpark(injector)
injectLegacy(injector.gluten.legacy)
injectRas(injector.gluten.ras)
}
}
private object VeloxRuleApi {
- def injectSpark(injector: SparkInjector): Unit = {
- // Regular Spark rules.
- injector.injectOptimizerRule(CollectRewriteRule.apply)
- injector.injectOptimizerRule(HLLRewriteRule.apply)
- injector.injectPostHocResolutionRule(ArrowConvertorRule.apply)
+ def injectSpark(injector: RuleInjector): Unit = {
Review Comment:
Can we make it
```suggestion
def injectSpark(exts: SparkSessionExtensions): Unit = {
```
? Thanks.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@gluten.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@gluten.apache.org
For additional commands, e-mail: commits-help@gluten.apache.org
Re: [PR] [GLUTEN-7364][CORE] Simplify the RuleInjector [incubator-gluten]
Posted by "beliefer (via GitHub)" <gi...@apache.org>.
beliefer commented on PR #7365:
URL: https://github.com/apache/incubator-gluten/pull/7365#issuecomment-2381051857
> The reason why we split the planning phase into `spark` and `gluten` is that we wanted to isolate Gluten's query planer with Spark, to the maximum extent. And we wanted Gluten to inject only one single built-in Spark `ColumnarRule` through `GlutenInjector`, so we hided `#injectColumnar` method by wrapping `SparkSessionExtensions` with `SparkInjector`. If we expose that API, we may need to pay more attention on Gluten PRs that add rules to make sure they do things right.
The rules for isolating Spark and Gluten are not a problem. As you said, Gluten to inject only one single built-in Spark `ColumnarRule` through `GlutenInjector`, so we hided `#injectColumnar` method by wrapping `SparkSessionExtensions` with `GlutenInjector`. But `SparkInjector` only copy the API from `SparkSessionExtensions`, so this PR doesn't change the `GlutenInjector` and only remove the `SparkInjector`. This PR doesn't break what the Gluten want.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@gluten.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@gluten.apache.org
For additional commands, e-mail: commits-help@gluten.apache.org
Re: [PR] [GLUTEN-7364][CORE] Simplify the RuleInjector [incubator-gluten]
Posted by "beliefer (via GitHub)" <gi...@apache.org>.
beliefer commented on code in PR #7365:
URL: https://github.com/apache/incubator-gluten/pull/7365#discussion_r1779832453
##########
gluten-core/src/main/scala/org/apache/gluten/extension/injector/RuleInjector.scala:
##########
@@ -19,12 +19,12 @@ package org.apache.gluten.extension.injector
import org.apache.spark.sql.SparkSessionExtensions
/** Injector used to inject query planner rules into Spark and Gluten. */
-class RuleInjector {
- val spark: SparkInjector = new SparkInjector()
+class RuleInjector(val extensions: SparkSessionExtensions) {
Review Comment:
In the world of Spark, Spark usually means to SparkSession.
For consistent, let's use `extensions`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@gluten.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@gluten.apache.org
For additional commands, e-mail: commits-help@gluten.apache.org