Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,8 @@ public void run() throws JobException {
try {
executeWithRetry(execPartitionNames, tableWithPartKey, ctx);
} catch (Exception e) {
LOG.error("Execution failed after retries: {}", e.getMessage());
LOG.error("Execution failed after retries, mvName: {}, taskId: {}",
mtmv.getName(), getTaskId(), e);
throw new JobException(e.getMessage(), e);
}
completedPartitions.addAll(execPartitionNames);
Expand All @@ -282,7 +283,8 @@ public void run() throws JobException {
mtmv.getDatabase().getFullName(), mtmv.getName(), getTaskId());
} catch (Throwable e) {
if (getStatus() == TaskStatus.RUNNING) {
LOG.warn("run task failed: {}", e.getMessage());
LOG.warn("run task failed, mvName: {}, taskId: {}",
mtmv.getName(), getTaskId(), e);
throw new JobException(e.getMessage(), e);
} else {
// if status is not `RUNNING`,maybe the task was canceled, therefore, it is a normal situation
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ public class MTMVPlanUtil {
RuleType.ELIMINATE_JOIN_BY_FK,
RuleType.ELIMINATE_JOIN_BY_UK,
RuleType.ELIMINATE_GROUP_BY_KEY_BY_UNIFORM,
RuleType.ELIMINATE_GROUP_BY_KEY,
RuleType.ELIMINATE_GROUP_BY,
RuleType.SALT_JOIN
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -673,7 +673,6 @@ public class Rewriter extends AbstractBatchJobExecutor {
cascadesContext -> cascadesContext.rewritePlanContainsTypes(LogicalAggregate.class)
|| cascadesContext.rewritePlanContainsTypes(LogicalJoin.class)
|| cascadesContext.rewritePlanContainsTypes(LogicalUnion.class),
topDown(new EliminateGroupByKey()),
topDown(new PushDownAggThroughJoinOnPkFk()),
topDown(new PullUpJoinFromUnionAll())
),
Expand Down Expand Up @@ -909,6 +908,11 @@ private static List<RewriteJob> getWholeTreeRewriteJobs(
)));
rewriteJobs.addAll(jobs(topic("convert outer join to anti",
custom(RuleType.CONVERT_OUTER_JOIN_TO_ANTI, ConvertOuterJoinToAntiJoin::new))));
rewriteJobs.addAll(jobs(topic("eliminate Aggregate according to fd items",
cascadesContext -> cascadesContext.rewritePlanContainsTypes(LogicalAggregate.class)
|| cascadesContext.rewritePlanContainsTypes(LogicalJoin.class)
|| cascadesContext.rewritePlanContainsTypes(LogicalUnion.class),
custom(RuleType.ELIMINATE_GROUP_BY_KEY, EliminateGroupByKey::new))));
rewriteJobs.addAll(jobs(topic("eliminate group by key by uniform",
custom(RuleType.ELIMINATE_GROUP_BY_KEY_BY_UNIFORM, EliminateGroupByKeyByUniform::new))));
if (needOrExpansion) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import org.apache.doris.nereids.CascadesContext;
import org.apache.doris.nereids.jobs.executor.Rewriter;
import org.apache.doris.nereids.properties.DataTrait;
import org.apache.doris.nereids.rules.RuleType;
import org.apache.doris.nereids.rules.analysis.NormalizeRepeat;
import org.apache.doris.nereids.rules.exploration.mv.AbstractMaterializedViewAggregateRule.AggregateExpressionRewriteContext.ExpressionRewriteMode;
import org.apache.doris.nereids.rules.exploration.mv.StructInfo.PlanCheckContext;
Expand Down Expand Up @@ -569,7 +570,8 @@ private static boolean isGroupByEqualsAfterGroupByEliminate(Set<Expression> quer
Plan rewrittenPlan = MaterializedViewUtils.rewriteByRules(cascadesContext,
childContext -> {
Rewriter.getCteChildrenRewriter(childContext,
ImmutableList.of(Rewriter.topDown(new EliminateGroupByKey()))).execute();
ImmutableList.of(Rewriter.custom(
RuleType.ELIMINATE_GROUP_BY_KEY, EliminateGroupByKey::new))).execute();
return childContext.getRewritePlan();
}, viewProject, viewProject, false);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ public class PreMaterializedViewRewriter {
NEED_PRE_REWRITE_RULE_TYPES.set(RuleType.DISTINCT_AGGREGATE_SPLIT.ordinal());
NEED_PRE_REWRITE_RULE_TYPES.set(RuleType.PROCESS_SCALAR_AGG_MUST_USE_MULTI_DISTINCT.ordinal());
NEED_PRE_REWRITE_RULE_TYPES.set(RuleType.ELIMINATE_GROUP_BY_KEY_BY_UNIFORM.ordinal());
NEED_PRE_REWRITE_RULE_TYPES.set(RuleType.ELIMINATE_GROUP_BY_KEY.ordinal());
NEED_PRE_REWRITE_RULE_TYPES.set(RuleType.SALT_JOIN.ordinal());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -235,10 +235,10 @@ public Rule build() {
List<Expression> groupByExprs = agg.getGroupByExpressions();
ExpressionRewriteContext context = new ExpressionRewriteContext(agg, ctx.cascadesContext);
List<Expression> newGroupByExprs = rewriter.rewrite(groupByExprs, context);

boolean groupByChanged = !newGroupByExprs.equals(groupByExprs);
List<NamedExpression> outputExpressions = agg.getOutputExpressions();
RewriteResult<NamedExpression> result = rewriteAll(outputExpressions, rewriter, context);
if (!result.changed) {
if (!result.changed && !groupByChanged) {
return agg;
}
return new LogicalAggregate<>(newGroupByExprs, result.result,
Expand Down
Loading
Loading