Package org.apache.iceberg.io
Interface CloseableIterable<T>
- All Superinterfaces:
AutoCloseable,Closeable,Iterable<T>
- All Known Implementing Classes:
AvroIterable,CloseableIterable.ConcatCloseableIterable,ManifestReader,ParallelIterable,ParquetIterable,ParquetReader,SortedMerge,VectorizedParquetReader,VectorizedTableScanIterable
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionstatic <E> CloseableIterable<E>static <E> CloseableIterable<E>concat(Iterable<CloseableIterable<E>> iterable) static <T> CloseableIterable<T>count(Counter counter, CloseableIterable<T> iterable) Counts the number of elements in the givenCloseableIterableby incrementing theCounterinstance for eachIterator.next()call.static <E> CloseableIterable<E>empty()static <E> CloseableIterable<E>filter(CloseableIterable<E> iterable, Predicate<E> pred) static <E> CloseableIterable<E>filter(Counter skipCounter, CloseableIterable<E> iterable, Predicate<E> pred) Filters the givenCloseableIterableand counts the number of elements that do not match the predicate by incrementing theCounter.iterator()Returns a closeable iterator over elements of typeT.static <I,O> CloseableIterable<O> transform(CloseableIterable<I> iterable, Function<I, O> transform) static <E> CloseableIterable<E>whenComplete(CloseableIterable<E> iterable, Runnable onCompletionRunnable) Will run the given runnable whenCloseable.close()has been called.static <E> CloseableIterable<E>withNoopClose(E entry) static <E> CloseableIterable<E>withNoopClose(Iterable<E> iterable) Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Method Details
-
iterator
CloseableIterator<T> iterator()Returns a closeable iterator over elements of typeT.- Specified by:
iteratorin interfaceIterable<T>- Returns:
- an
CloseableIterator.
-
withNoopClose
-
withNoopClose
-
empty
-
combine
-
whenComplete
static <E> CloseableIterable<E> whenComplete(CloseableIterable<E> iterable, Runnable onCompletionRunnable) Will run the given runnable whenCloseable.close()has been called.- Type Parameters:
E- The type of the underlying iterable- Parameters:
iterable- The underlyingCloseableIterableto iterate overonCompletionRunnable- The runnable to run after the underlying iterable was closed- Returns:
- A new
CloseableIterablewhere the runnable will be executed as the final step afterCloseable.close()has been called
-
filter
-
filter
static <E> CloseableIterable<E> filter(Counter skipCounter, CloseableIterable<E> iterable, Predicate<E> pred) Filters the givenCloseableIterableand counts the number of elements that do not match the predicate by incrementing theCounter.- Type Parameters:
E- The underlying type to be iterated.- Parameters:
skipCounter- TheCounterinstance to increment on each skipped item during filtering.iterable- The underlyingCloseableIterableto filter.- Returns:
- A filtered
CloseableIterablewhere the given skipCounter is incremented whenever the predicate does not match.
-
count
Counts the number of elements in the givenCloseableIterableby incrementing theCounterinstance for eachIterator.next()call.- Type Parameters:
T- The underlying type to be iterated.- Parameters:
counter- TheCounterinstance to increment on eachIterator.next()call.iterable- The underlyingCloseableIterableto count- Returns:
- A
CloseableIterablethat increments the given counter on eachIterator.next()call.
-
transform
static <I,O> CloseableIterable<O> transform(CloseableIterable<I> iterable, Function<I, O> transform) -
concat
-