dongjoon-hyun commented on a change in pull request #36011:
URL: https://github.com/apache/spark/pull/36011#discussion_r841176375



##########
File path: 
sql/core/src/main/scala/org/apache/spark/sql/SparkSessionExtensions.scala
##########
@@ -294,4 +295,23 @@ class SparkSessionExtensions {
   def injectTableFunction(functionDescription: TableFunctionDescription): Unit 
= {
     injectedTableFunctions += functionDescription
   }
+
+  private[this] val runtimeOptimizerRules = mutable.Buffer.empty[RuleBuilder]
+
+  private[sql] def buildRuntimeOptimizerRules(session: SparkSession): 
Seq[Rule[LogicalPlan]] = {
+    runtimeOptimizerRules.map(_.apply(session)).toSeq
+  }
+
+  /**
+   * Inject a runtime `Rule` builder into the [[SparkSession]].
+   * The injected rules will be executed after built-in
+   * [[org.apache.spark.sql.execution.adaptive.AQEOptimizer]] rules are 
applied.
+   * A runtime optimizer rule is used to improve the quality of a logical plan 
during execution
+   * which can leverage accurate statistics from shuffle.
+   *
+   * Note that, it does not work if adaptive query execution is disabled.
+   */
+  def injectRuntimeOptimizerRule(builder: RuleBuilder): Unit = {
+    runtimeOptimizerRules += builder
+  }

Review comment:
       Shall we move these new additions somewhere around the exiting 
`queryStagePrepRuleBuilders` and `buildQueryStagePrepRules`?




-- 
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: reviews-unsubscr...@spark.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to