[fix](stats) sort partitions when do sample analyze (#32185)

This commit is contained in:
zhengyu
2024-03-20 12:04:07 +08:00
committed by yiguolei
parent 9f98200f27
commit 6d401451cc

View File

@ -39,6 +39,7 @@ import java.security.SecureRandom;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@ -254,7 +255,9 @@ public class OlapAnalysisTask extends BaseAnalysisTask {
List<Long> sampleTabletIds = new ArrayList<>();
long actualSampledRowCount = 0;
boolean enough = false;
for (Partition p : olapTable.getPartitions()) {
List<Partition> sortedPartitions = olapTable.getPartitions().stream().sorted(
Comparator.comparing(Partition::getName)).collect(Collectors.toList());
for (Partition p : sortedPartitions) {
MaterializedIndex materializedIndex = info.indexId == -1 ? p.getBaseIndex() : p.getIndex(info.indexId);
if (materializedIndex == null) {
continue;