Interface CloseableIteratorWithMetadata<T>
-
- All Superinterfaces:
AutoCloseable
,Closeable
,CloseableIterator<T>
,Iterator<T>
public interface CloseableIteratorWithMetadata<T> extends CloseableIterator<T>
LikeCloseableIterator
, but has a currentMetadata() method, which returns "metadata", which is effectively a Mapabout the source of last value returned by next() The returned metadata is read-only and cannot be modified. This metadata can be used as additional information to pin-point the root cause of a parse exception. So it can include information that helps with such exercise. For example, for a TextReader
that information can be the line number. Only per row context needs to be passed here so for kafka it could be an offset. The source information is already available viaIntermediateRowParsingReader.source()
method and needn't be included
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description Map<String,Object>
currentMetadata()
static <T> CloseableIteratorWithMetadata<T>
withEmptyMetadata(CloseableIterator<T> delegate)
Creates an instance of CloseableIteratorWithMetadata from aCloseableIterator
.-
Methods inherited from interface org.apache.druid.java.util.common.parsers.CloseableIterator
flatMap, map
-
Methods inherited from interface java.util.Iterator
forEachRemaining, hasNext, next, remove
-
-
-
-
Method Detail
-
currentMetadata
Map<String,Object> currentMetadata()
- Returns:
- A map containing the information about the source of the last value returned by
Iterator.next()
-
withEmptyMetadata
static <T> CloseableIteratorWithMetadata<T> withEmptyMetadata(CloseableIterator<T> delegate)
Creates an instance of CloseableIteratorWithMetadata from aCloseableIterator
.currentMetadata()
for the instance is guaranteed to return an empty map
-
-