You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by en...@apache.org on 2024/07/02 05:54:12 UTC
(doris) branch branch-2.1 updated: [opt](nereids)using mv's derived stats #35721 (#37098)
This is an automated email from the ASF dual-hosted git repository.
englefly pushed a commit to branch branch-2.1
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/branch-2.1 by this push:
new 0c8934642e9 [opt](nereids)using mv's derived stats #35721 (#37098)
0c8934642e9 is described below
commit 0c8934642e9e1840f455021f458bbbaf3d2bfbb8
Author: minghong <en...@gmail.com>
AuthorDate: Tue Jul 2 13:54:05 2024 +0800
[opt](nereids)using mv's derived stats #35721 (#37098)
pick from #35721
(cherry picked from commit a481d79b1e258f7b6711157bb0d5e4c224e680e5)
## Proposed changes
Issue Number: close #xxx
<!--Describe your changes.-->
---
.../org/apache/doris/nereids/stats/StatsCalculator.java | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/stats/StatsCalculator.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/stats/StatsCalculator.java
index 6a8d1234050..4d4f68bb29a 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/nereids/stats/StatsCalculator.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/stats/StatsCalculator.java
@@ -760,6 +760,21 @@ public class StatsCalculator extends DefaultPlanVisitor<Statistics, Void> {
// 2. Consider the influence of runtime filter
// 3. Get NDV and column data size from StatisticManger, StatisticManager doesn't support it now.
private Statistics computeCatalogRelation(CatalogRelation catalogRelation) {
+ if (catalogRelation instanceof LogicalOlapScan) {
+ LogicalOlapScan olap = (LogicalOlapScan) catalogRelation;
+ if (olap.getSelectedIndexId() != olap.getTable().getBaseIndexId()) {
+ // mv is selected, return its estimated stats
+ Optional<Statistics> optStats = cascadesContext.getStatementContext()
+ .getStatistics(olap.getRelationId());
+ if (optStats.isPresent()) {
+ double actualRowCount = catalogRelation.getTable().getRowCountForNereids();
+ if (actualRowCount > optStats.get().getRowCount()) {
+ return optStats.get();
+ }
+ }
+ }
+ }
+
List<Slot> output = catalogRelation.getOutput();
ImmutableSet.Builder<SlotReference> slotSetBuilder = ImmutableSet.builderWithExpectedSize(output.size());
for (Slot slot : output) {
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org