HangyuanLiu commented on a change in pull request #3651:
URL: https://github.com/apache/incubator-doris/pull/3651#discussion_r429155817



##########
File path: fe/src/main/java/org/apache/doris/alter/MaterializedViewHandler.java
##########
@@ -457,8 +462,23 @@ private RollupJobV2 createMaterializedViewJob(String 
mvName, String baseIndexNam
                                                + "duplicate table");
             }
             Column newMVColumn = new Column(baseColumn);
+
             newMVColumn.setIsKey(mvColumnItem.isKey());
             newMVColumn.setAggregationType(mvAggregationType, 
mvColumnItem.isAggregationTypeImplicit());
+            newMVColumn.setDefineExpr(mvColumnItem.getDefineExpr());
+            if (mvColumnItem.getDefineExpr() != null) {
+                if (mvAggregationType.equals(BITMAP_UNION)) {
+                    newMVColumn.setType(Type.BITMAP);
+                    newMVColumn.setName(MATERIALIZED_VIEW_NAME_PRFIX + 
"bitmap_" + baseColumn.getName());
+                } else if (mvAggregationType.equals(HLL_UNION)){
+                    newMVColumn.setType(Type.HLL);
+                    newMVColumn.setName(MATERIALIZED_VIEW_NAME_PRFIX + "hll_" 
+ baseColumn.getName());
+                } else {
+                    throw new DdlException("The define expr of column is only 
support bitmap_union or hll_union");
+                }
+                newMVColumn.setIsKey(false);

Review comment:
       If the aggregate function is computed for the original column, it should 
be not key whether  the original column is a key column or a value column




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to