diff --git a/fe/fe-core/src/main/java/org/apache/doris/datasource/FileQueryScanNode.java b/fe/fe-core/src/main/java/org/apache/doris/datasource/FileQueryScanNode.java index 16b19ac77b2bb0..69115e969b0ba3 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/datasource/FileQueryScanNode.java +++ b/fe/fe-core/src/main/java/org/apache/doris/datasource/FileQueryScanNode.java @@ -340,7 +340,10 @@ public void createScanRangeLocations() throws UserException { totalFileSize = fileSplit.getLength() * selectedSplitNum; long maxWaitTime = ConnectContext.get().getSessionVariable().getFetchSplitsMaxWaitTime(); // Not accurate, only used to estimate concurrency. - int numSplitsPerBE = numApproximateSplits() / backendPolicy.numBackends(); + // Here, we must take the max of 1, because + // in the case of multiple BEs, `numApproximateSplits() / backendPolicy.numBackends()` may be 0, + // and finally numSplitsPerBE is 0, resulting in no data being queried. + int numSplitsPerBE = Math.max(numApproximateSplits() / backendPolicy.numBackends(), 1); for (Backend backend : backendPolicy.getBackends()) { SplitSource splitSource = new SplitSource(backend, splitAssignment, maxWaitTime); splitSources.add(splitSource);