[fix](fe)ordering exprs should be substituted in the same way as select part (#20091)
This commit is contained in:
@ -1366,6 +1366,10 @@ public class SelectStmt extends QueryStmt {
|
||||
havingClauseAfterAnaylzed =
|
||||
havingClauseAfterAnaylzed.substitute(countAllMap, analyzer, false);
|
||||
}
|
||||
if (sortInfo != null) {
|
||||
// the ordering exprs must substitute in the same way as resultExprs
|
||||
sortInfo.substituteOrderingExprs(countAllMap, analyzer);
|
||||
}
|
||||
aggExprs.clear();
|
||||
TreeNode.collect(substitutedAggs, Expr.isAggregatePredicate(), aggExprs);
|
||||
|
||||
|
||||
@ -7,3 +7,6 @@ all 2
|
||||
-- !select2 --
|
||||
1.0 1
|
||||
|
||||
-- !select3 --
|
||||
1.0 1
|
||||
|
||||
|
||||
@ -54,7 +54,9 @@
|
||||
"""
|
||||
sql """insert into cf_member values(2, 2, '2'); """
|
||||
|
||||
qt_select2 """select floor(id-1.0), count(*) from cf_member cm group by floor(id-1.0);"""
|
||||
qt_select2 """select floor(id-1.0), count(*) from cf_member cm group by floor(id-1.0) order by floor(id-1.0);"""
|
||||
|
||||
qt_select3 """select floor(id-1.0), count(*) from cf_member cm group by 1 order by 1;"""
|
||||
|
||||
sql """DROP TABLE IF EXISTS `cf_member`; """
|
||||
}
|
||||
Reference in New Issue
Block a user