Cherry-picked from #48492 Co-authored-by: morrySnow <zhangwenxin@selectdb.com>
This commit is contained in:
committed by
GitHub
parent
155e908b0e
commit
fc842fcbf6
@ -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) {
|
||||
|
||||
@ -77,6 +77,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 (
|
||||
|
||||
Reference in New Issue
Block a user