[Chore](materialized-view) forbiden create mv with where clause contained aggregate column (#18168)
forbiden create mv with where clause contained aggregate column
create table a_table(
k1 int null,
k2 int not null,
k3 bigint null,
k4 bigint sum null,
k5 bitmap bitmap_union null,
k6 hll hll_union null
)
aggregate key (k1,k2,k3)
distributed BY hash(k1) buckets 3
properties("replication_num" = "1");
create materialized view where_1 as select k1,k4 from a_table where k4 =1; // invalid, mv on agg table need group by
create materialized view where_2 as select k1,sum(k4) from a_table where k4 =1 group by k1; // invalid, k4 is agg column
create materialized view where_2 as select k1,sum(k4) from a_table where k1+k4 =1 group by k1; // invalid, k4 is agg column
This commit is contained in:
@ -165,6 +165,11 @@ public class CreateMaterializedViewStmt extends DdlStmt {
|
||||
analyzeSelectClause(analyzer);
|
||||
analyzeFromClause();
|
||||
if (selectStmt.getWhereClause() != null) {
|
||||
if (!isReplay && selectStmt.getWhereClause().hasAggregateSlot()) {
|
||||
throw new AnalysisException(
|
||||
"The where clause contained aggregate column is not supported, expr:"
|
||||
+ selectStmt.getWhereClause().toSql());
|
||||
}
|
||||
whereClauseItem = new MVColumnItem(selectStmt.getWhereClause());
|
||||
}
|
||||
if (selectStmt.getHavingPred() != null) {
|
||||
|
||||
Reference in New Issue
Block a user