This is an automated email from the ASF dual-hosted git repository.
morrysnow 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 ed2ec7b460a [opt](nereids) show user friendly error msg when window
function contains order by expression (#40937)
ed2ec7b460a is described below
commit ed2ec7b460a79eac66b240a3415e189c76901f22
Author: starocean999 <[email protected]>
AuthorDate: Fri Sep 20 11:11:51 2024 +0800
[opt](nereids) show user friendly error msg when window function contains
order by expression (#40937)
---
.../nereids/rules/rewrite/ExtractAndNormalizeWindowExpression.java | 4 ++++
.../normalize_window/normalize_window_nullable_agg_test.groovy | 4 ++++
2 files changed, 8 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..9617e8bb19c 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,8 @@ 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;"
+ 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: [email protected]
For additional commands, e-mail: [email protected]