Skip to content

Commit

Permalink
[fix](split)Fixed the bug that batch mode split could not query data …
Browse files Browse the repository at this point in the history
…in multiple be scenarios. (#46218)

### What problem does this PR solve?
Problem Summary:
In multiple be scenarios, batch mode split sometimes could not query
data.

The reason is that the estimated `numApproximateSplits()` may be
relatively small, and the value after dividing the current number of be
may be 0. As a result, the split will not be distributed to be, and the
query result will be empty.
We need to take the max of the value after division and 1.
  • Loading branch information
hubgeter authored Dec 31, 2024
1 parent 22eb777 commit c83e45d
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit c83e45d

Please sign in to comment.