[fix](planner)remove constant expr in window function's partition and order exprs (#36185)

pick from master https://github.com/apache/doris/pull/36184
This commit is contained in:
starocean999
2024-06-13 15:05:21 +08:00
committed by GitHub
parent e51cd58d6e
commit d70751a808

View File

@ -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(