cloud-fan commented on a change in pull request #32944:
URL: https://github.com/apache/spark/pull/32944#discussion_r662517185



##########
File path: 
sql/core/src/main/scala/org/apache/spark/sql/execution/adaptive/costing.scala
##########
@@ -17,16 +17,32 @@
 
 package org.apache.spark.sql.execution.adaptive
 
+import org.apache.spark.internal.Logging
 import org.apache.spark.sql.execution.SparkPlan
+import org.apache.spark.util.Utils
 
 /**
- * Represents the cost of a plan.
+ * An interface to represent the cost of a plan.
  */
 trait Cost extends Ordered[Cost]
 
 /**
- * Evaluates the cost of a physical plan.
+ * An interface to evaluate the cost of a physical plan.
  */
 trait CostEvaluator {
   def evaluateCost(plan: SparkPlan): Cost
 }
+
+object CostEvaluator extends Logging {
+
+  /**
+   * Instantiates a [[CostEvaluator]] using the given className.
+   */
+  def instantiate(className: String): CostEvaluator = {
+    logDebug(s"Creating CostEvaluator $className")
+    val clazz = Utils.classForName[CostEvaluator](className)

Review comment:
       We can use the standard API in Spark: `Utils.loadExtensions`




-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to