[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:
@ -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(
|
||||
|
||||
Reference in New Issue
Block a user