This is an automated email from the ASF dual-hosted git repository.
dataroaring pushed a commit to branch branch-3.0
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/branch-3.0 by this push:
new f4aefd058cd branch-3.0: [fix](Nereids) nested window function with
order by raise exception #48492 (#48676)
f4aefd058cd is described below
commit f4aefd058cd7015969f3ae9339a24b90ddb8b89a
Author: github-actions[bot]
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Mon Mar 10 12:19:58 2025 +0800
branch-3.0: [fix](Nereids) nested window function with order by raise
exception #48492 (#48676)
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 df3fd63d750..3d95cc23549 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
@@ -73,6 +73,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]