private CompletableFuture < Iterator < T > > batch ( ) { return batch . thenCompose ( iterator -> { if ( iterator != null && ! iterator . hasNext ( ) ) { batch = fetch ( iterator . position ( ) ) ; return batch . thenApply ( Function . identity ( ) ) ; } return CompletableFuture . completedFuture ( iterator ) ; } ) ; }
Returns the current batch iterator or lazily fetches the next batch from the cluster .