This is an automated email from the ASF dual-hosted git repository.
yiguolei pushed a commit to branch branch-2.1
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/branch-2.1 by this push:
new fc842fcbf69 branch-2.1: [fix](Nereids) nested window function with
order by raise exception #48492 (#48677)
fc842fcbf69 is described below
commit fc842fcbf692a4b0e5ee875115251a55a6f602ca
Author: github-actions[bot]
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Wed Mar 5 17:30:09 2025 +0800
branch-2.1: [fix](Nereids) nested window function with order by raise
exception #48492 (#48677)
Cherry-picked from #48492
Co-authored-by: morrySnow <[email protected]>
---
.../rules/rewrite/ExtractAndNormalizeWindowExpression.java | 2 +-
.../normalize_window/normalize_window_nullable_agg_test.groovy | 10 ++++++++++
2 files changed, 11 insertions(+), 1 deletion(-)
diff --git
a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/ExtractAndNormalizeWindowExpression.java
b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/ExtractAndNormalizeWindowExpression.java
index a74ebe4b76b..02165709564 100644
---
a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/ExtractAndNormalizeWindowExpression.java
+++
b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/ExtractAndNormalizeWindowExpression.java
@@ -62,7 +62,7 @@ public class ExtractAndNormalizeWindowExpression extends
OneRewriteRuleFactory i
if (output instanceof WindowExpression) {
WindowExpression windowExpression = (WindowExpression)
output;
Expression expression = ((WindowExpression)
output).getFunction();
- if (expression.containsType(OrderExpression.class)) {
+ if
(expression.children().stream().anyMatch(OrderExpression.class::isInstance)) {
throw new AnalysisException("order by is not
supported in " + expression);
}
if (expression instanceof NullableAggregateFunction) {
diff --git
a/regression-test/suites/nereids_rules_p0/normalize_window/normalize_window_nullable_agg_test.groovy
b/regression-test/suites/nereids_rules_p0/normalize_window/normalize_window_nullable_agg_test.groovy
index 3ae299517a6..2035a55aecb 100644
---
a/regression-test/suites/nereids_rules_p0/normalize_window/normalize_window_nullable_agg_test.groovy
+++
b/regression-test/suites/nereids_rules_p0/normalize_window/normalize_window_nullable_agg_test.groovy
@@ -77,6 +77,16 @@ suite("normalize_window_nullable_agg") {
exception "order by is not supported"
}
+ test {
+ sql "select group_concat(cast(sum(xwhat) over(partition by xwho order
by xwhen) as varchar) order by xwhat) over(partition by xwhen) from
windowfunnel_test_normalize_window;"
+ exception "order by is not supported"
+ }
+
+ // test only refuse order by in function's direct children
+ sql """
+ select sum(sum(xwhat) over(partition by xwho order by xwhen))
over(partition by xwho) from windowfunnel_test_normalize_window
+ """
+
sql "set enable_fold_constant_by_be = 1;"
sql "drop table if exists fold_window1"
sql """create table fold_window1 (
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]