Code review comment: not necessary to log warning, I will add it to query trace log.

Code before review:
private void prepareRelatedMVs(Set<Table> queryTables, Set<MaterializedView> relatedMvs, boolean isSyncMV) {
String queryExcludingMVNames = connectContext.getSessionVariable().getQueryExcludingMVNames();
String queryIncludingMVNames = connectContext.getSessionVariable().getQueryIncludingMVNames();
if (!Strings.isNullOrEmpty(queryExcludingMVNames) || !Strings.isNullOrEmpty(queryIncludingMVNames)) {
Set<String> queryExcludingMVNamesSet = Sets.newHashSet(queryExcludingMVNames.split(","));
Set<String> queryIncludingMVNamesSet = Sets.newHashSet(queryIncludingMVNames.split(","));
relatedMvs = relatedMvs.stream()
.filter(mv -> queryIncludingMVNamesSet.contains(mv.getName()))
.filter(mv -> !queryExcludingMVNamesSet.contains(mv.getName()))
.collect(Collectors.toSet());
}
if (relatedMvs.isEmpty()) {
logMVPrepare(connectContext, "[SYNC={}] There are no related mvs for the query plan", isSyncMV);
return;
}
Set<ColumnRefOperator> originQueryColumns = Sets.newHashSet(queryColumnRefFactory.getColumnRefs());
for (MaterializedView mv : relatedMvs) {
if (!mv.isValidPlan()) {
continue;
}
try {
preprocessMv(mv, queryTables, originQueryColumns, isSyncMV);
} catch (Exception e) {
List<String> tableNames = queryTables.stream().map(Table::getName).collect(Collectors.toList());
LOG.warn("[SYNC={}] Preprocess mv {} failed for query tables:{}", isSyncMV, mv.getName(), tableNames, e);
}
}
if (relatedMvs.isEmpty()) {
logMVPrepare(connectContext, "[SYNC={}] There are no related mvs after process", isSyncMV);
return;
}
List<String> relatedMvNames = relatedMvs.stream().map(mv -> mv.getName()).collect(Collectors.toList());
List<String> candidateMvNames = context.getCandidateMvs().stream()
.map(materializationContext -> materializationContext.getMv().getName()).collect(Collectors.toList());
logMVPrepare(connectContext, "[SYNC={}] RelatedMVs: {}, CandidateMVs: {}", isSyncMV, relatedMvNames,
candidateMvNames);
}


Code after addressing the review:
private void prepareRelatedMVs(Set<Table> queryTables, Set<MaterializedView> relatedMvs, boolean isSyncMV) {
String queryExcludingMVNames = connectContext.getSessionVariable().getQueryExcludingMVNames();
String queryIncludingMVNames = connectContext.getSessionVariable().getQueryIncludingMVNames();
if (!Strings.isNullOrEmpty(queryExcludingMVNames) || !Strings.isNullOrEmpty(queryIncludingMVNames)) {
Set<String> queryExcludingMVNamesSet = Sets.newHashSet(queryExcludingMVNames.split(","));
Set<String> queryIncludingMVNamesSet = Sets.newHashSet(queryIncludingMVNames.split(","));
relatedMvs = relatedMvs.stream()
.filter(mv -> queryIncludingMVNamesSet.contains(mv.getName()))
.filter(mv -> !queryExcludingMVNamesSet.contains(mv.getName()))
.collect(Collectors.toSet());
}
if (relatedMvs.isEmpty()) {
logMVPrepare(connectContext, "[SYNC={}] There are no related mvs for the query plan", isSyncMV);
return;
}
Set<ColumnRefOperator> originQueryColumns = Sets.newHashSet(queryColumnRefFactory.getColumnRefs());
for (MaterializedView mv : relatedMvs) {
if (!mv.isValidPlan()) {
continue;
}
try {
preprocessMv(mv, queryTables, originQueryColumns, isSyncMV);
} catch (Exception e) {
List<String> tableNames = queryTables.stream().map(Table::getName).collect(Collectors.toList());
LOG.warn("[SYNC={}] Preprocess mv {} failed for query tables:{}", isSyncMV, mv.getName(), tableNames, e);
}
}
if (relatedMvs.isEmpty()) {
logMVPrepare(connectContext, "[SYNC={}] There are no related mvs after process", isSyncMV);
return;
}
List<String> relatedMvNames = relatedMvs.stream().map(mv -> mv.getName()).collect(Collectors.toList());
List<String> candidateMvNames = context.getCandidateMvs().stream()
.map(materializationContext -> materializationContext.getMv().getName()).collect(Collectors.toList());
logMVPrepare(connectContext, "[SYNC={}] RelatedMVs: {}, CandidateMVs: {}", isSyncMV, relatedMvNames,
candidateMvNames);
}