zml1206 commented on code in PR #7857:
URL: https://github.com/apache/incubator-gluten/pull/7857#discussion_r1833716284


##########
gluten-core/src/main/scala/org/apache/gluten/GlutenPlugin.scala:
##########
@@ -134,7 +134,11 @@ private[gluten] class GlutenDriverPlugin extends 
DriverPlugin with Logging {
     conf.set(SPARK_SESSION_EXTENSIONS.key, extensions)
 
     // adaptive custom cost evaluator class
-    if (GlutenConfig.getConf.enableGluten && 
GlutenConfig.getConf.enableGlutenCostEvaluator) {
+    val glutenEnabled = conf.getBoolean(GlutenConfig.GLUTEN_ENABLED_KEY, 
GLUTEN_ENABLED_BY_DEFAULT)
+    lazy val enableGlutenCostEvaluator = conf.getBoolean(
+      GlutenConfig.GLUTEN_COST_EVALUATOR_ENABLED,
+      GLUTEN_COST_EVALUATOR_DEFAULT_VALUE)
+    if (glutenEnabled && enableGlutenCostEvaluator) {
       val costEvaluator = 
"org.apache.spark.sql.execution.adaptive.GlutenCostEvaluator"
       conf.set(SQLConf.ADAPTIVE_CUSTOM_COST_EVALUATOR_CLASS.key, costEvaluator)
     }

Review Comment:
   `GlutenCostEvaluator` will judge whether gluten is enabled at 
runtime(https://github.com/apache/incubator-gluten/blob/3e6263e204aee9b5f1d1afe06102cb97251c08ed/shims/spark34/src/main/scala/org/apache/spark/sql/execution/adaptive/GlutenCostEvaluator.scala#L29),
 when gluten is disabled, the cost is the same as vanilla spark. 
`GlutenCostEvaluator` is added for use the smaller table to build hashmap in 
shuffled hash join and `CostEvaluator` does not support dynamic changes. So 
Retained `enableGlutenCostEvaluator` condition and remove `glutenEnabled` 
condition would be more appropriate?



-- 
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