This is an automated email from the ASF dual-hosted git repository.
yiguolei 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 26b0cefabc1 branch-2.1[fix](nereids) fix bug in
StatsCalculator.disableJoinReorderIfStatsInvalid when rowCount is not aviable
#53834 (#54426)
26b0cefabc1 is described below
commit 26b0cefabc1675d5be502957277996fcfa709975
Author: minghong <[email protected]>
AuthorDate: Thu Aug 14 09:47:51 2025 +0800
branch-2.1[fix](nereids) fix bug in
StatsCalculator.disableJoinReorderIfStatsInvalid when rowCount is not aviable
#53834 (#54426)
### What problem does this PR solve?
Pick #53834
Issue Number: close #xxx
Related PR: #xxx
---
.../org/apache/doris/nereids/stats/StatsCalculator.java | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)
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 0a1ae85adfe..c0110a88ef7 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
@@ -133,6 +133,7 @@ import
org.apache.doris.nereids.trees.plans.visitor.DefaultPlanVisitor;
import org.apache.doris.nereids.types.DataType;
import org.apache.doris.nereids.util.PlanUtils;
import org.apache.doris.qe.ConnectContext;
+import org.apache.doris.qe.SessionVariable;
import org.apache.doris.statistics.AnalysisManager;
import org.apache.doris.statistics.ColumnStatistic;
import org.apache.doris.statistics.ColumnStatisticBuilder;
@@ -362,8 +363,14 @@ public class StatsCalculator extends
DefaultPlanVisitor<Statistics, Void> {
double rowCount = calculator.getTableRowCount(scan);
// row count not available
if (rowCount == -1) {
- LOG.info("disable join reorder since row count not available: "
- + scan.getTable().getNameWithFullQualifiers());
+ try {
+ ConnectContext.get().getSessionVariable()
+ .setVarOnce(SessionVariable.DISABLE_JOIN_REORDER,
"true");
+ LOG.info("disable join reorder since row count not
available: "
+ + scan.getTable().getNameWithFullQualifiers());
+ } catch (Exception e) {
+ LOG.info("disableNereidsJoinReorderOnce failed");
+ }
return Optional.of("table[" + scan.getTable().getName() + "]
row count is invalid");
}
if (scan instanceof OlapScan) {
@@ -371,7 +378,8 @@ public class StatsCalculator extends
DefaultPlanVisitor<Statistics, Void> {
Optional<String> reason =
calculator.checkNdvValidation((OlapScan) scan, rowCount);
if (reason.isPresent()) {
try {
-
ConnectContext.get().getSessionVariable().disableNereidsJoinReorderOnce();
+ ConnectContext.get().getSessionVariable()
+
.setVarOnce(SessionVariable.DISABLE_JOIN_REORDER, "true");
LOG.info("disable join reorder since col stats
invalid: "
+ reason.get());
} catch (Exception e) {
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]