[fix](Nereids) set card to olap table break card block rule (#28417)

we have card block rule to avoid scan too many data.
so we must set olap scan card by only scanned bucket.
This commit is contained in:
morrySnow
2023-12-15 10:28:05 +08:00
committed by GitHub
parent 4d9b6c272d
commit 1877389f12
2 changed files with 5 additions and 1 deletions

View File

@ -588,7 +588,9 @@ public class PhysicalPlanTranslator extends DefaultPlanVisitor<PlanFragment, Pla
OlapScanNode olapScanNode = new OlapScanNode(olapScan.translatePlanNodeId(), tupleDescriptor, "OlapScanNode");
// TODO: move all node set cardinality into one place
if (olapScan.getStats() != null) {
olapScanNode.setCardinality((long) olapScan.getStats().getRowCount());
// NOTICE: we should not set stats row count
// because it is whole table cardinality and will break block rules.
// olapScanNode.setCardinality((long) olapScan.getStats().getRowCount());
if (context.getSessionVariable() != null && context.getSessionVariable().forbidUnknownColStats) {
for (int i = 0; i < slots.size(); i++) {
SlotReference slot = (SlotReference) slots.get(i);

View File

@ -1628,6 +1628,8 @@ public class OlapScanNode extends ScanNode {
public void finalizeForNereids() {
computeNumNodes();
computeStatsForNereids();
// NOTICE: must call here to get selected tablet row count to let block rules work well.
mockRowCountInStatistic();
if (!SessionVariable.enablePipelineEngineX()) {
// distributionColumnIds is used for one backend node agg optimization, nereids do not support it.
distributionColumnIds.clear();