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
-
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 givenCloseableIterable
by incrementing theCounter
instance 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 givenCloseableIterable
and 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:
iterator
in 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 underlyingCloseableIterable
to iterate overonCompletionRunnable
- The runnable to run after the underlying iterable was closed- Returns:
- A new
CloseableIterable
where 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 givenCloseableIterable
and 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
- TheCounter
instance to increment on each skipped item during filtering.iterable
- The underlyingCloseableIterable
to filter.- Returns:
- A filtered
CloseableIterable
where the given skipCounter is incremented whenever the predicate does not match.
-
count
Counts the number of elements in the givenCloseableIterable
by incrementing theCounter
instance for eachIterator.next()
call.- Type Parameters:
T
- The underlying type to be iterated.- Parameters:
counter
- TheCounter
instance to increment on eachIterator.next()
call.iterable
- The underlyingCloseableIterable
to count- Returns:
- A
CloseableIterable
that increments the given counter on eachIterator.next()
call.
-
transform
static <I,O> CloseableIterable<O> transform(CloseableIterable<I> iterable, Function<I, O> transform) -
concat
-