Skip to content

Commit

Permalink
[fix](planner)remove constant expr in window function's partition and…
Browse files Browse the repository at this point in the history
… order exprs (#36185)

pick from master #36184
  • Loading branch information
starocean999 committed Jun 13, 2024
1 parent e51cd58 commit d70751a
Showing 1 changed file with 2 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -475,22 +475,8 @@ void checkOffset(Analyzer analyzer) throws AnalysisException {
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(
Expand Down

0 comments on commit d70751a

Please sign in to comment.