This is an automated email from the ASF dual-hosted git repository.
starocean999 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/master by this push:
new b052621150d [fix](planner)remove constant expr in window function's
partition and order exprs (#36184)
b052621150d is described below
commit b052621150df2f3f955d0f87cbb695586cdc5708
Author: starocean999 <[email protected]>
AuthorDate: Thu Jun 13 09:51:08 2024 +0800
[fix](planner)remove constant expr in window function's partition and order
exprs (#36184)
the legacy planner reports error if there is constant expr in window
function's partition or order by keys. This pr just remove these
unnecessary constant exprs and make planner happy.
now:
`SELECT row_number() OVER (partition by 1 order by 2) from t`
will be changed to
`SELECT row_number() OVER () from t `
---
.../java/org/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 7028370dc45..87681a636e2 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(
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]