[fix](planner) Fix agg on inlineview which with constant slot (#18201)

Since slot that reference to constant has been marked as constant expr either, just add condition check to make sure such slot wouldn't be eliminated as constant from group exprs
This commit is contained in:
AKIRA
2023-03-31 00:54:37 +09:00
committed by GitHub
parent 28793b6441
commit b5ea299697
4 changed files with 45 additions and 2 deletions

View File

@ -1387,7 +1387,7 @@ public class SelectStmt extends QueryStmt {
for (Expr groupExpr : groupingExprs) {
//remove groupExpr if it is const, and it is not in select list
boolean removeConstGroupingKey = false;
if (groupExpr.isConstant()) {
if (groupExpr.isConstant() && !(groupExpr.contains(e -> e instanceof SlotRef))) {
if (theFirstConstantGroupingExpr == null) {
theFirstConstantGroupingExpr = groupExpr;
}