[fix](planner) Fix table sample not take effect (#29594)

Modify computeSampleTabletIds location. table sample not take effect because selectedIndexId=-1 in computeSampleTabletIds, the previous run FE UT had special processing, so FE UT did not discover the BUG in time.
This commit is contained in:
Xinyi Zou
2024-01-06 02:08:40 +08:00
committed by GitHub
parent 0ae449f732
commit 05d1f4f71d
2 changed files with 2 additions and 5 deletions

View File

@ -643,7 +643,6 @@ public class PhysicalPlanTranslator extends DefaultPlanVisitor<PlanFragment, Pla
if (olapScan.getTableSample().isPresent()) {
olapScanNode.setTableSample(new TableSample(olapScan.getTableSample().get().isPercent,
olapScan.getTableSample().get().sampleValue, olapScan.getTableSample().get().seek));
olapScanNode.computeSampleTabletIds();
}
// TODO: remove this switch?

View File

@ -555,7 +555,6 @@ public class OlapScanNode extends ScanNode {
computePartitionInfo();
}
computeTupleState(analyzer);
computeSampleTabletIds();
/**
* Compute InAccurate cardinality before mv selector and tablet pruning.
@ -949,6 +948,7 @@ public class OlapScanNode extends ScanNode {
Preconditions.checkState(selectedIndexId != -1);
// compute tablet info by selected index id and selected partition ids
long start = System.currentTimeMillis();
computeSampleTabletIds();
computeTabletInfo();
LOG.debug("distribution prune cost: {} ms", (System.currentTimeMillis() - start));
}
@ -971,9 +971,7 @@ public class OlapScanNode extends ScanNode {
long selectedRows = 0;
long totalSampleRows = 0;
List<Long> selectedPartitionList = new ArrayList<>();
if (FeConstants.runningUnitTest && selectedIndexId == -1) {
selectedIndexId = olapTable.getBaseIndexId();
}
Preconditions.checkState(selectedIndexId != -1);
for (Long partitionId : selectedPartitionIds) {
final Partition partition = olapTable.getPartition(partitionId);
final MaterializedIndex selectedIndex = partition.getIndex(selectedIndexId);