[opt](nereids)show user friendly error msg when window function contains order by expression (#40937) (#41036)

pick from master #40937
This commit is contained in:
starocean999
2024-09-20 18:50:55 +08:00
committed by GitHub
parent a8aebe6394
commit dbd72deaa5
2 changed files with 12 additions and 0 deletions

View File

@ -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.