From d70751a808dbc86d81adec6307c4d1751b302f29 Mon Sep 17 00:00:00 2001 From: starocean999 <40539150+starocean999@users.noreply.github.com> Date: Thu, 13 Jun 2024 15:05:21 +0800 Subject: [PATCH] [fix](planner)remove constant expr in window function's partition and order exprs (#36185) pick from master https://github.com/apache/doris/pull/36184 --- .../apache/doris/analysis/AnalyticExpr.java | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) 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(