You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by GitBox <gi...@apache.org> on 2022/11/14 14:24:41 UTC
[GitHub] [doris] sohardforaname commented on a diff in pull request #13659: [Feature](Nereids)support nereids event for logging the cascades states and transformation.
sohardforaname commented on code in PR #13659:
URL: https://github.com/apache/doris/pull/13659#discussion_r1021604810
##########
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();
Review Comment:
it's just reverse if-statement, it may be read more easily.
--
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-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org