AshinGau commented on code in PR #34032: URL: https://github.com/apache/doris/pull/34032#discussion_r1599289491
########## fe/fe-core/src/main/java/org/apache/doris/datasource/hive/source/HiveScanNode.java: ########## @@ -217,6 +229,46 @@ protected List<Split> getSplits() throws UserException { } } + public List<Split> getNextBatch(int maxBatchSize) throws UserException { + try { + HiveMetaStoreCache cache = Env.getCurrentEnv().getExtMetaCacheMgr() + .getMetaStoreCache((HMSExternalCatalog) hmsTable.getCatalog()); + String bindBrokerName = hmsTable.getCatalog().bindBrokerName(); + List<Split> allFiles = Lists.newArrayList(); + int numPartitions = 0; + while (allFiles.size() < maxBatchSize && prunedPartitionsIter.hasNext()) { + List<HivePartition> partitions = new ArrayList<>(NUM_PARTITIONS_PER_LOOP); + for (int i = 0; i < NUM_PARTITIONS_PER_LOOP && prunedPartitionsIter.hasNext(); ++i) { + partitions.add(prunedPartitionsIter.next()); + numPartitions++; + } + getFileSplitByPartitions(cache, partitions, allFiles, bindBrokerName); + } + if (allFiles.size() / numPartitions > numSplitsPerPartition) { + numSplitsPerPartition = allFiles.size() / numPartitions; + } + return allFiles; + } catch (Throwable t) { + LOG.warn("get file split failed for table: {}", hmsTable.getName(), t); + throw new UserException( + "get file split failed for table: " + hmsTable.getName() + ", err: " + Util.getRootCauseMessage(t), + t); + } + } + + public boolean hasNext() { + return prunedPartitionsIter.hasNext(); + } + + public boolean isBatchMode() { + int numPartitions = ConnectContext.get().getSessionVariable().getNumPartitionsInBatchMode(); Review Comment: When stable, the getSplits() interface will be removed, only the batch interface will be used -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org