diff --git a/fe/fe-core/src/main/java/org/apache/doris/datasource/hive/source/HiveScanNode.java b/fe/fe-core/src/main/java/org/apache/doris/datasource/hive/source/HiveScanNode.java index db4161a4e2..634c596c69 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/datasource/hive/source/HiveScanNode.java +++ b/fe/fe-core/src/main/java/org/apache/doris/datasource/hive/source/HiveScanNode.java @@ -257,30 +257,32 @@ public class HiveScanNode extends FileQueryScanNode { } try { splittersOnFlight.acquire(); - } catch (InterruptedException e) { + CompletableFuture.runAsync(() -> { + try { + List allFiles = Lists.newArrayList(); + getFileSplitByPartitions( + cache, Collections.singletonList(partition), allFiles, bindBrokerName); + if (allFiles.size() > numSplitsPerPartition.get()) { + numSplitsPerPartition.set(allFiles.size()); + } + splitAssignment.addToQueue(allFiles); + } catch (IOException e) { + batchException.set(new UserException(e.getMessage(), e)); + } finally { + splittersOnFlight.release(); + if (batchException.get() != null) { + splitAssignment.setException(batchException.get()); + } + if (numFinishedPartitions.incrementAndGet() == prunedPartitions.size()) { + splitAssignment.finishSchedule(); + } + } + }, scheduleExecutor); + } catch (Exception e) { + // When submitting a task, an exception will be thrown if the task pool(scheduleExecutor) is full batchException.set(new UserException(e.getMessage(), e)); break; } - CompletableFuture.runAsync(() -> { - try { - List allFiles = Lists.newArrayList(); - getFileSplitByPartitions(cache, Collections.singletonList(partition), allFiles, bindBrokerName); - if (allFiles.size() > numSplitsPerPartition.get()) { - numSplitsPerPartition.set(allFiles.size()); - } - splitAssignment.addToQueue(allFiles); - } catch (IOException e) { - batchException.set(new UserException(e.getMessage(), e)); - } finally { - splittersOnFlight.release(); - if (batchException.get() != null) { - splitAssignment.setException(batchException.get()); - } - if (numFinishedPartitions.incrementAndGet() == prunedPartitions.size()) { - splitAssignment.finishSchedule(); - } - } - }, scheduleExecutor); } if (batchException.get() != null) { splitAssignment.setException(batchException.get());