maropu commented on a change in pull request #24136: [SPARK-27088][SQL] Apply 
conf "spark.sql.optimizer.planChangeLog.leve…
URL: https://github.com/apache/spark/pull/24136#discussion_r266884205
 
 

 ##########
 File path: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/rules/RuleExecutor.scala
 ##########
 @@ -189,5 +183,26 @@ abstract class RuleExecutor[TreeType <: TreeNode[_]] 
extends Logging {
         }
       }
     }
+
+    def logBatch(batchName: String, oldPlan: TreeType, newPlan: TreeType): 
Unit = {
+      if (logBatches.isEmpty || logBatches.get.contains(batchName)) {
+        lazy val message = if (!oldPlan.fastEquals(newPlan)) {
+          s"""
+             |=== Result of Batch ${batchName} ===
+             |${sideBySide(oldPlan.treeString, 
newPlan.treeString).mkString("\n")}
+          """.stripMargin
+        } else {
+          s"Batch ${batchName} has no effect."
+        }
+        logLevel match {
 
 Review comment:
   Can you define a helper func to remove the duplicate code in the line 
176-182?
   
https://github.com/apache/spark/pull/24136/files#diff-f70523b948b7af21abddfa3ab7e1d7d6R176

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

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

Reply via email to