Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[branch-2.0-var](sample) Fix computeSampleTabletIds NullPointerException #26434

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -948,9 +948,13 @@ public void computeSampleTabletIds() {
}
for (Long partitionId : selectedPartitionIds) {
final Partition partition = olapTable.getPartition(partitionId);
final MaterializedIndex selectedTable = partition.getIndex(selectedIndexId);
selectedRows += selectedTable.getRowCount();
selectedPartitionList.add(partitionId);
final MaterializedIndex selectedIndex = partition.getIndex(selectedIndexId);
// selectedIndex is not expected to be null, because MaterializedIndex ids in one rollup's partitions
// are all same. skip this partition here.
if (selectedIndex != null) {
selectedRows += selectedIndex.getRowCount();
selectedPartitionList.add(partitionId);
}
}
selectedPartitionList.sort(Comparator.naturalOrder());

Expand All @@ -970,7 +974,7 @@ public void computeSampleTabletIds() {
// 3. Sampling partition. If Seek is specified, the partition will be the same for each sampling.
long hitRows = 0; // The number of rows hit by the tablet
long partitionSeek = tableSample.getSeek() != -1
? tableSample.getSeek() : (long) (new SecureRandom().nextDouble() * selectedPartitionIds.size());
? tableSample.getSeek() : (long) (new SecureRandom().nextDouble() * selectedPartitionList.size());
for (int i = 0; i < selectedPartitionList.size(); i++) {
int seekPid = (int) ((i + partitionSeek) % selectedPartitionList.size());
final Partition partition = olapTable.getPartition(selectedPartitionList.get(seekPid));
Expand Down