in paimon-python-java-bridge/src/main/java/org/apache/paimon/python/ParallelBytesReader.java [119:138]
private <T> Iterator<T> futuresToIterIter(List<Future<Iterator<T>>> futures) {
final Queue<Future<Iterator<T>>> queue = new ArrayDeque<>(futures);
return Iterators.concat(
new Iterator<Iterator<T>>() {
public boolean hasNext() {
return !queue.isEmpty();
}
public Iterator<T> next() {
try {
return queue.poll().get();
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
throw new RuntimeException(e);
} catch (ExecutionException e) {
throw new RuntimeException(e);
}
}
});
}