Skip to content

Commit

Permalink
fix code usage
Browse files Browse the repository at this point in the history
  • Loading branch information
seawinde committed Dec 12, 2024
1 parent 3869a64 commit 3ae875d
Showing 1 changed file with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
import org.apache.doris.nereids.rules.expression.rules.FoldConstantRuleOnFE;
import org.apache.doris.nereids.rules.rewrite.MergeProjects;
import org.apache.doris.nereids.trees.expressions.Alias;
import org.apache.doris.nereids.trees.expressions.ComparisonPredicate;
import org.apache.doris.nereids.trees.expressions.Expression;
import org.apache.doris.nereids.trees.expressions.NamedExpression;
import org.apache.doris.nereids.trees.expressions.Not;
Expand Down Expand Up @@ -137,6 +138,7 @@ public List<Plan> rewrite(Plan queryPlan, CascadesContext cascadesContext) {
rewrittenPlans.addAll(doRewrite(queryStructInfo, cascadesContext, context));
}
} catch (Exception exception) {
LOG.warn("Materialized view rule exec fail", exception);
context.recordFailReason(queryStructInfo,
"Materialized view rule exec fail", exception::toString);
}
Expand Down Expand Up @@ -608,8 +610,14 @@ protected List<Expression> rewriteExpression(List<? extends Expression> sourceEx
// if contains any slot to rewrite, which means can not be rewritten by target,
// expressionShuttledToRewrite is slot#0 > '2024-01-01' but mv plan output is date_trunc(slot#0, 'day')
// which would try to rewrite
if (viewExprParamToDateTruncMap.isEmpty()
|| expressionShuttledToRewrite.children().isEmpty()
|| !(expressionShuttledToRewrite instanceof ComparisonPredicate)) {
// view doesn't have date_trunc, or
// expressionShuttledToRewrite is not ComparisonPredicate, bail out
return ImmutableList.of();
}
Expression queryShuttledExprParam = expressionShuttledToRewrite.child(0);

Expression queryOriginalExpr = sourceExpressionsToWrite.get(exprIndex);
if (!queryExprToInfoMap.containsKey(queryOriginalExpr)
|| !viewExprParamToDateTruncMap.containsKey(queryShuttledExprParam)) {
Expand Down

0 comments on commit 3ae875d

Please sign in to comment.