in flink-doris-connector/src/main/java/org/apache/doris/flink/rest/RestService.java [778:817]
static List<PartitionDefinition> tabletsMapToPartition(
DorisOptions options,
DorisReadOptions readOptions,
Map<String, List<Long>> be2Tablets,
String opaquedQueryPlan,
String database,
String table,
Logger logger)
throws IllegalArgumentException {
int tabletsSize = tabletCountLimitForOnePartition(readOptions, logger);
List<PartitionDefinition> partitions = new ArrayList<>();
for (Entry<String, List<Long>> beInfo : be2Tablets.entrySet()) {
logger.debug("Generate partition with beInfo: '{}'.", beInfo);
HashSet<Long> tabletSet = new HashSet<>(beInfo.getValue());
beInfo.getValue().clear();
beInfo.getValue().addAll(tabletSet);
int first = 0;
while (first < beInfo.getValue().size()) {
Set<Long> partitionTablets =
new HashSet<>(
beInfo.getValue()
.subList(
first,
Math.min(
beInfo.getValue().size(),
first + tabletsSize)));
first = first + tabletsSize;
PartitionDefinition partitionDefinition =
new PartitionDefinition(
database,
table,
beInfo.getKey(),
partitionTablets,
opaquedQueryPlan);
logger.debug("Generate one PartitionDefinition '{}'.", partitionDefinition);
partitions.add(partitionDefinition);
}
}
return partitions;
}