[fix](inbitmap) forbid having clause to include in bitmap. (#15494)

This commit is contained in:
luozenglin
2023-01-04 14:33:18 +08:00
committed by GitHub
parent e0c56bcd20
commit a4af1fbf90
2 changed files with 16 additions and 0 deletions

View File

@ -957,6 +957,13 @@ public class SelectStmt extends QueryStmt {
}
}
private boolean isContainInBitmap(Expr expr) {
List<Expr> inPredicates = Lists.newArrayList();
expr.collect(InPredicate.class, inPredicates);
return inPredicates.stream().anyMatch(e -> e.getChild(1) instanceof Subquery
&& ((Subquery) e.getChild(1)).getStatement().getResultExprs().get(0).getType().isBitmapType());
}
/**
* Analyze aggregation-relevant components of the select block (Group By clause,
* select list, Order By clause),
@ -1017,6 +1024,10 @@ public class SelectStmt extends QueryStmt {
"HAVING clause must not contain analytic expressions: "
+ analyticExpr.toSql());
}
if (isContainInBitmap(havingClauseAfterAnaylzed)) {
throw new AnalysisException(
"HAVING clause dose not support in bitmap syntax: " + havingClauseAfterAnaylzed.toSql());
}
}
if (groupByClause == null && !selectList.isDistinct()