This is an automated email from the ASF dual-hosted git repository. morrysnow 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 dbd72deaa5c [opt](nereids)show user friendly error msg when window function contains order by expression (#40937) (#41036) dbd72deaa5c is described below commit dbd72deaa5c901cba0d0a8f37a48c88f1cdb3d07 Author: starocean999 <40539150+starocean...@users.noreply.github.com> AuthorDate: Fri Sep 20 18:50:55 2024 +0800 [opt](nereids)show user friendly error msg when window function contains order by expression (#40937) (#41036) pick from master #40937 --- .../rules/rewrite/ExtractAndNormalizeWindowExpression.java | 4 ++++ .../normalize_window/normalize_window_nullable_agg_test.groovy | 8 ++++++++ 2 files changed, 12 insertions(+) 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 e82c3f7b416..2cfe4523003 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 @@ -17,6 +17,7 @@ package org.apache.doris.nereids.rules.rewrite; +import org.apache.doris.nereids.exceptions.AnalysisException; import org.apache.doris.nereids.rules.Rule; import org.apache.doris.nereids.rules.RuleType; import org.apache.doris.nereids.trees.expressions.Alias; @@ -60,6 +61,9 @@ public class ExtractAndNormalizeWindowExpression extends OneRewriteRuleFactory i if (output instanceof WindowExpression) { WindowExpression windowExpression = (WindowExpression) output; Expression expression = ((WindowExpression) output).getFunction(); + if (expression.containsType(OrderExpression.class)) { + throw new AnalysisException("order by is not supported in " + expression); + } if (expression instanceof NullableAggregateFunction) { // NullableAggregateFunction in window function should be always nullable // Because there may be no data in the window frame, null values will be generated. 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 915a4d025a8..7087797e4e4 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 @@ -68,4 +68,12 @@ suite("normalize_window_nullable_agg") { // qt_window_funnel """select window_funnel(3600 * 3, 'default', t.xwhen, t.xwhat = 1, t.xwhat = 2 ) over (order by xwhat rows // between 2 preceding and 1 preceding) AS level from windowfunnel_test_normalize_window t;""" qt_sequence_match "SELECT sequence_match('(?1)(?2)', xwhen, xwhat = 1, xwhat = 3) over (order by xwhat rows between 2 preceding and 1 preceding) FROM windowfunnel_test_normalize_window;" + + + sql "set enable_nereids_planner=true;" + sql "set enable_fallback_to_original_planner=false;" + test { + sql "select group_concat(xwho order by xwhat) over(partition by xwhen) from windowfunnel_test_normalize_window;" + exception "order by is not supported" + } } \ No newline at end of file --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org