[Improvment](materialized-view) add short circuit for selectBestMV #23743

This commit is contained in:
Pxl
2023-09-01 14:46:54 +08:00
committed by GitHub
parent eaf2a6a80e
commit 0e9dd348fb

View File

@ -125,6 +125,11 @@ public class MaterializedViewSelector {
long start = System.currentTimeMillis();
Preconditions.checkState(scanNode instanceof OlapScanNode);
OlapScanNode olapScanNode = (OlapScanNode) scanNode;
if (olapScanNode.getOlapTable().getVisibleIndex().size() == 1) {
return new BestIndexInfo(olapScanNode.getOlapTable().getBaseIndexId(), isPreAggregation, reasonOfDisable);
}
Map<Long, List<Column>> candidateIndexIdToSchema = predicates(olapScanNode);
if (candidateIndexIdToSchema.keySet().size() == 0) {
return null;