diff --git a/fe/fe-core/src/main/java/org/apache/doris/analysis/AnalyticExpr.java b/fe/fe-core/src/main/java/org/apache/doris/analysis/AnalyticExpr.java index 5906e55965..390d0a349f 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/analysis/AnalyticExpr.java +++ b/fe/fe-core/src/main/java/org/apache/doris/analysis/AnalyticExpr.java @@ -475,22 +475,8 @@ public class AnalyticExpr extends Expr { public void analyzeImpl(Analyzer analyzer) throws AnalysisException { fnCall.analyze(analyzer); type = getFnCall().getType(); - - for (Expr e : partitionExprs) { - if (e.isLiteral()) { - throw new AnalysisException( - "Expressions in the PARTITION BY clause must not be constant: " - + e.toSql() + " (in " + toSql() + ")"); - } - } - - for (OrderByElement e : orderByElements) { - if (e.getExpr().isLiteral()) { - throw new AnalysisException( - "Expressions in the ORDER BY clause must not be constant: " - + e.getExpr().toSql() + " (in " + toSql() + ")"); - } - } + partitionExprs.removeIf(expr -> expr.isConstant()); + orderByElements.removeIf(expr -> expr.getExpr().isConstant()); if (getFnCall().getParams().isDistinct()) { throw new AnalysisException(