sohardforaname commented on code in PR #13659:
URL: https://github.com/apache/doris/pull/13659#discussion_r1025965057


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/jobs/Job.java:
##########
@@ -89,47 +91,33 @@ public List<Rule> getValidRules(GroupExpression 
groupExpression,
 
     public abstract void execute() throws AnalysisException;
 
-    protected Optional<CopyInResult> invokeRewriteRuleWithTrace(Rule rule, 
Plan before, Group targetGroup) {
+    protected Optional<CopyInResult> invokeRewriteRuleWithTrace(Rule rule, 
Plan before, Group targetGroup,
+            EventProducer transformTracer) {
         context.onInvokeRule(rule.getRuleType());
-
-        String traceBefore = enableTrace ? getPlanTraceLog() : null;
+        COUNTER_TRACER.log(new CounterEvent(Memo.getStateId(),
+                CounterType.EXPRESSION_TRANSFORM, targetGroup, 
targetGroup.getLogicalExpression(), before));
 
         List<Plan> afters = rule.transform(before, 
context.getCascadesContext());
         Preconditions.checkArgument(afters.size() == 1);
         Plan after = afters.get(0);
-
-        if (after != before) {
-            CopyInResult result = context.getCascadesContext()
-                    .getMemo()
-                    .copyIn(after, targetGroup, true);
-
-            if (result.generateNewExpression && enableTrace) {
-                String traceAfter = getPlanTraceLog();
-                printTraceLog(rule, traceBefore, traceAfter);
-            }
-
-            return Optional.of(result);
+        if (after == before) {
+            return Optional.empty();
         }
 
-        return Optional.empty();
-    }
-
-    protected String getPlanTraceLog() {
-        return context.getCascadesContext()
+        CopyInResult result = context.getCascadesContext()
                 .getMemo()
-                .copyOut(false)
-                .treeString();
-    }
+                .copyIn(after, targetGroup, true);
 
-    protected String getMemoTraceLog() {
-        return context.getCascadesContext()
-                .getMemo()
-                .getRoot()
-                .treeString();
+        if (result.generateNewExpression) {

Review Comment:
   ok!



-- 
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: commits-unsubscr...@doris.apache.org

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


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

Reply via email to