diff --git a/common/src/main/scala/org/apache/comet/CometConf.scala b/common/src/main/scala/org/apache/comet/CometConf.scala index 76973c00a..06112cae8 100644 --- a/common/src/main/scala/org/apache/comet/CometConf.scala +++ b/common/src/main/scala/org/apache/comet/CometConf.scala @@ -276,13 +276,13 @@ object CometConf { .booleanConf .createWithDefault(false) - val COMET_EXPLAIN_ENABLED: ConfigEntry[String] = - conf("spark.comet.explain") + val COMET_EXPLAIN_FALLBACK_ENABLED: ConfigEntry[Boolean] = + conf("spark.comet.explainFallback.enabled") .doc( - "Set this config to VERBOSE to see logging explaining the reason(s) why a query " + - "stage cannot be executed natively with Comet.") - .stringConf - .createWithDefault("VERBOSE") + "When this setting is enabled, Comet will provide logging explaining the reason(s) " + + "why a query stage cannot be executed natively with Comet.") + .booleanConf + .createWithDefault(false) val COMET_BATCH_SIZE: ConfigEntry[Int] = conf("spark.comet.batchSize") .doc("The columnar batch size, i.e., the maximum number of rows that a batch can contain.") diff --git a/spark/src/main/scala/org/apache/comet/CometSparkSessionExtensions.scala b/spark/src/main/scala/org/apache/comet/CometSparkSessionExtensions.scala index 5b1375111..c43439196 100644 --- a/spark/src/main/scala/org/apache/comet/CometSparkSessionExtensions.scala +++ b/spark/src/main/scala/org/apache/comet/CometSparkSessionExtensions.scala @@ -734,21 +734,19 @@ class CometSparkSessionExtensions } else { var newPlan = transform(plan) - // if the plan cannot be run natively then explain why, if verbose explain is enabled - if (!isCometNative(newPlan)) { - if ("VERBOSE".equals(CometConf.COMET_EXPLAIN_ENABLED.get())) { - new ExtendedExplainInfo().extensionInfo(newPlan) match { - case reasons if reasons.isEmpty => - logWarning( - "Comet cannot execute this plan natively, but no reason is given. " + - "This is likely a bug.") - case reasons if reasons.size == 1 => - logWarning(s"Comet cannot execute this plan natively because ${reasons.head}") - case reasons => - logWarning( - "Comet cannot execute this plan natively because:\n\t- " + - s"${reasons.mkString("\n\t- ")}") - } + // if the plan cannot be run natively then explain why (when appropriate config is enabled) + if (CometConf.COMET_EXPLAIN_FALLBACK_ENABLED.get() && !isCometNative(newPlan)) { + new ExtendedExplainInfo().extensionInfo(newPlan) match { + case reasons if reasons.isEmpty => + logWarning( + "Comet cannot execute this plan natively, but no reason is given. " + + "This is likely a bug.") + case reasons if reasons.size == 1 => + logWarning(s"Comet cannot execute this plan natively because ${reasons.head}") + case reasons => + logWarning( + "Comet cannot execute this plan natively because:\n\t- " + + s"${reasons.mkString("\n\t- ")}") } }