This is an automated email from the ASF dual-hosted git repository.
morrysnow pushed a commit to branch branch-3.1
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/branch-3.1 by this push:
new bdf559f6f04 branch-3.1: [Enhancement](nereids) config rf wait time in
cloud mode #47579 (#51873)
bdf559f6f04 is described below
commit bdf559f6f04e2d931b612588fb0b4ddefe0116b7
Author: minghong <[email protected]>
AuthorDate: Thu Jun 19 19:28:33 2025 +0800
branch-3.1: [Enhancement](nereids) config rf wait time in cloud mode #47579
(#51873)
pick from master #47579
---
.../org/apache/doris/nereids/NereidsPlanner.java | 70 ++++++++++++----------
1 file changed, 40 insertions(+), 30 deletions(-)
diff --git
a/fe/fe-core/src/main/java/org/apache/doris/nereids/NereidsPlanner.java
b/fe/fe-core/src/main/java/org/apache/doris/nereids/NereidsPlanner.java
index 85e40c6c7b3..f7a65a83f1b 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/nereids/NereidsPlanner.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/NereidsPlanner.java
@@ -22,6 +22,7 @@ import org.apache.doris.analysis.ExplainOptions;
import org.apache.doris.analysis.StatementBase;
import org.apache.doris.catalog.Column;
import org.apache.doris.catalog.TableIf;
+import org.apache.doris.common.Config;
import org.apache.doris.common.FeConstants;
import org.apache.doris.common.FormatOptions;
import org.apache.doris.common.NereidsException;
@@ -300,39 +301,48 @@ public class NereidsPlanner extends Planner {
}
/**
- * compute rf wait time according to max table row count, if wait time is
not default value
- * olap:
- * row < 1G: 1 sec
- * 1G <= row < 10G: 5 sec
- * 10G < row: 20 sec
- * external:
- * row < 1G: 5 sec
- * 1G <= row < 10G: 10 sec
- * 10G < row: 50 sec
+ * config rf wait time if wait time is the same as default value
+ * 1. local mode, config according to max table row count
+ * a. olap table:
+ * row < 1G: 1 sec
+ * 1G <= row < 10G: 5 sec
+ * 10G < row: 20 sec
+ * b. external table:
+ * row < 1G: 5 sec
+ * 1G <= row < 10G: 10 sec
+ * 10G < row: 50 sec
+ * 2. cloud mode, config it as query time out
*/
- private void setRuntimeFilterWaitTimeByTableRowCountAndType() {
- if (ConnectContext.get() != null &&
ConnectContext.get().getSessionVariable().getRuntimeFilterWaitTimeMs()
- !=
VariableMgr.getDefaultSessionVariable().getRuntimeFilterWaitTimeMs()) {
- List<LogicalCatalogRelation> scans =
cascadesContext.getRewritePlan()
- .collectToList(LogicalCatalogRelation.class::isInstance);
- double maxRow = StatsCalculator.getMaxTableRowCount(scans,
cascadesContext);
- boolean hasExternalTable = scans.stream().anyMatch(scan -> !(scan
instanceof LogicalOlapScan));
+ private void configRuntimeFilterWaitTime() {
+ if (ConnectContext.get() != null &&
ConnectContext.get().getSessionVariable() != null
+ &&
ConnectContext.get().getSessionVariable().getRuntimeFilterWaitTimeMs()
+ ==
VariableMgr.getDefaultSessionVariable().getRuntimeFilterWaitTimeMs()) {
SessionVariable sessionVariable =
ConnectContext.get().getSessionVariable();
- if (hasExternalTable) {
- if (maxRow < 1_000_000_000L) {
-
sessionVariable.setVarOnce(SessionVariable.RUNTIME_FILTER_WAIT_TIME_MS, "5000");
- } else if (maxRow < 10_000_000_000L) {
-
sessionVariable.setVarOnce(SessionVariable.RUNTIME_FILTER_WAIT_TIME_MS,
"20000");
- } else {
-
sessionVariable.setVarOnce(SessionVariable.RUNTIME_FILTER_WAIT_TIME_MS,
"50000");
- }
+ if (Config.isCloudMode()) {
+
sessionVariable.setVarOnce(SessionVariable.RUNTIME_FILTER_WAIT_TIME_MS,
+
String.valueOf(Math.max(VariableMgr.getDefaultSessionVariable().getRuntimeFilterWaitTimeMs(),
+ 1000 * sessionVariable.getQueryTimeoutS())));
} else {
- if (maxRow < 1_000_000_000L) {
-
sessionVariable.setVarOnce(SessionVariable.RUNTIME_FILTER_WAIT_TIME_MS, "1000");
- } else if (maxRow < 10_000_000_000L) {
-
sessionVariable.setVarOnce(SessionVariable.RUNTIME_FILTER_WAIT_TIME_MS, "5000");
+ List<LogicalCatalogRelation> scans =
cascadesContext.getRewritePlan()
+
.collectToList(LogicalCatalogRelation.class::isInstance);
+ double maxRow = StatsCalculator.getMaxTableRowCount(scans,
cascadesContext);
+ boolean hasExternalTable = scans.stream().anyMatch(scan ->
!(scan instanceof LogicalOlapScan));
+ if (hasExternalTable) {
+ if (maxRow < 1_000_000_000L) {
+
sessionVariable.setVarOnce(SessionVariable.RUNTIME_FILTER_WAIT_TIME_MS, "5000");
+ } else if (maxRow < 10_000_000_000L) {
+
sessionVariable.setVarOnce(SessionVariable.RUNTIME_FILTER_WAIT_TIME_MS,
"20000");
+ } else {
+
sessionVariable.setVarOnce(SessionVariable.RUNTIME_FILTER_WAIT_TIME_MS,
"50000");
+ }
} else {
-
sessionVariable.setVarOnce(SessionVariable.RUNTIME_FILTER_WAIT_TIME_MS,
"20000");
+ if (maxRow < 1_000_000_000L) {
+
sessionVariable.setVarOnce(SessionVariable.RUNTIME_FILTER_WAIT_TIME_MS, "1000");
+ } else if (maxRow < 10_000_000_000L) {
+
sessionVariable.setVarOnce(SessionVariable.RUNTIME_FILTER_WAIT_TIME_MS, "5000");
+ } else {
+
sessionVariable.setVarOnce(SessionVariable.RUNTIME_FILTER_WAIT_TIME_MS,
"20000");
+ }
}
}
}
@@ -406,7 +416,7 @@ public class NereidsPlanner extends Planner {
.disableJoinReorderIfStatsInvalid(scans, cascadesContext);
disableJoinReorderReason.ifPresent(statementContext::setDisableJoinReorderReason);
}
- setRuntimeFilterWaitTimeByTableRowCountAndType();
+ configRuntimeFilterWaitTime();
if (LOG.isDebugEnabled()) {
LOG.debug("Start optimize plan");
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]