Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -60,6 +61,9 @@ private Plan normalize(LogicalProject<Plan> project) {
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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}