Code review comment: There is really no problem with this repair. But I think a better way is: 1. Modify MVColumnOneChildPattern 2. ```             if (isReplay) {                   ignore pattern             } else {match pattern}      ```

Code before review:
public void analyzeSelectClause() throws AnalysisException {
SelectList selectList = selectStmt.getSelectList();
if (selectList.getItems().isEmpty()) {
throw new AnalysisException("The materialized view must contain at least one column");
}
boolean meetAggregate = false;
Set<String> mvColumnNameSet = Sets.newHashSet();
/**
* 1. The columns of mv must be a single column or a aggregate column without any calculate.
*    Also the children of aggregate column must be a single column without any calculate.
*    For example:
*        a, sum(b) is legal.
*        a+b, sum(a+b) is illegal.
* 2. The SUM, MIN, MAX function is supported. The other function will be supported in the future.
* 3. The aggregate column must be declared after the single column.
*/
for (int i = 0; i < selectList.getItems().size(); i++) {
SelectListItem selectListItem = selectList.getItems().get(i);
Expr selectListItemExpr = selectListItem.getExpr();
if (!(selectListItemExpr instanceof SlotRef) && !(selectListItemExpr instanceof FunctionCallExpr)) {
throw new AnalysisException("The materialized view only support the single column or function expr. "
+ "Error column: " + selectListItemExpr.toSql());
}
if (selectListItemExpr instanceof SlotRef) {
if (meetAggregate) {
throw new AnalysisException("The aggregate column should be after the single column");
}
SlotRef slotRef = (SlotRef) selectListItemExpr;
String columnName = slotRef.getColumnName().toLowerCase();
if (!mvColumnNameSet.add(columnName)) {
ErrorReport.reportAnalysisException(ErrorCode.ERR_DUP_FIELDNAME, columnName);
}
MVColumnItem mvColumnItem = new MVColumnItem(columnName, slotRef.getType());
mvColumnItemList.add(mvColumnItem);
} else if (selectListItemExpr instanceof FunctionCallExpr) {
FunctionCallExpr functionCallExpr = (FunctionCallExpr) selectListItemExpr;
String functionName = functionCallExpr.getFnName().getFunction();
if (!isReplay && functionName.toLowerCase().equals("count") && functionCallExpr.isDistinct()) {
throw new AnalysisException(
"Materialized view does not support distinct function " + functionCallExpr.toSqlImpl());
}
MVColumnPattern mvColumnPattern = FN_NAME_TO_PATTERN.get(functionName.toLowerCase());
if (mvColumnPattern == null) {
throw new AnalysisException(
"Materialized view does not support this function:" + functionCallExpr.toSqlImpl());
}
if (!mvColumnPattern.match(functionCallExpr)) {
throw new AnalysisException(
"The function " + functionName + " must match pattern:" + mvColumnPattern.toString());
}
List<SlotRef> slots = new ArrayList<>();
functionCallExpr.collect(SlotRef.class, slots);
Preconditions.checkArgument(slots.size() == 1);
String columnName = slots.get(0).getColumnName().toLowerCase();
if (!mvColumnNameSet.add(columnName)) {
ErrorReport.reportAnalysisException(ErrorCode.ERR_DUP_FIELDNAME, columnName);
}
if (beginIndexOfAggregation == -1) {
beginIndexOfAggregation = i;
}
meetAggregate = true;
mvColumnItemList.add(buildMVColumnItem(functionCallExpr));
}
}
if (beginIndexOfAggregation == 0) {
throw new AnalysisException("The materialized view must contain at least one key column");
}
}

Line under review: if (!isReplay && functionName.toLowerCase().equals("count") && functionCallExpr.isDistinct()) {

Code after addressing the review:
public void analyzeSelectClause() throws AnalysisException {
SelectList selectList = selectStmt.getSelectList();
if (selectList.getItems().isEmpty()) {
throw new AnalysisException("The materialized view must contain at least one column");
}
boolean meetAggregate = false;
Set<String> mvColumnNameSet = Sets.newHashSet();
/**
* 1. The columns of mv must be a single column or a aggregate column without any calculate.
*    Also the children of aggregate column must be a single column without any calculate.
*    For example:
*        a, sum(b) is legal.
*        a+b, sum(a+b) is illegal.
* 2. The SUM, MIN, MAX function is supported. The other function will be supported in the future.
* 3. The aggregate column must be declared after the single column.
*/
for (int i = 0; i < selectList.getItems().size(); i++) {
SelectListItem selectListItem = selectList.getItems().get(i);
Expr selectListItemExpr = selectListItem.getExpr();
if (!(selectListItemExpr instanceof SlotRef) && !(selectListItemExpr instanceof FunctionCallExpr)) {
throw new AnalysisException("The materialized view only support the single column or function expr. "
+ "Error column: " + selectListItemExpr.toSql());
}
if (selectListItemExpr instanceof SlotRef) {
if (meetAggregate) {
throw new AnalysisException("The aggregate column should be after the single column");
}
SlotRef slotRef = (SlotRef) selectListItemExpr;
String columnName = slotRef.getColumnName().toLowerCase();
if (!mvColumnNameSet.add(columnName)) {
ErrorReport.reportAnalysisException(ErrorCode.ERR_DUP_FIELDNAME, columnName);
}
MVColumnItem mvColumnItem = new MVColumnItem(columnName, slotRef.getType());
mvColumnItemList.add(mvColumnItem);
} else if (selectListItemExpr instanceof FunctionCallExpr) {
FunctionCallExpr functionCallExpr = (FunctionCallExpr) selectListItemExpr;
String functionName = functionCallExpr.getFnName().getFunction();
if (!isReplay) {
MVColumnPattern mvColumnPattern = FN_NAME_TO_PATTERN.get(functionName.toLowerCase());
if (mvColumnPattern == null) {
throw new AnalysisException(
"Materialized view does not support this function:" + functionCallExpr.toSqlImpl());
}
if (!mvColumnPattern.match(functionCallExpr)) {
throw new AnalysisException(
"The function " + functionName + " must match pattern:" + mvColumnPattern.toString());
}
}
List<SlotRef> slots = new ArrayList<>();
functionCallExpr.collect(SlotRef.class, slots);
Preconditions.checkArgument(slots.size() == 1);
String columnName = slots.get(0).getColumnName().toLowerCase();
if (!mvColumnNameSet.add(columnName)) {
ErrorReport.reportAnalysisException(ErrorCode.ERR_DUP_FIELDNAME, columnName);
}
if (beginIndexOfAggregation == -1) {
beginIndexOfAggregation = i;
}
meetAggregate = true;
mvColumnItemList.add(buildMVColumnItem(functionCallExpr));
}
}
if (beginIndexOfAggregation == 0) {
throw new AnalysisException("The materialized view must contain at least one key column");
}
}