Interface CloseableIteratorWithMetadata<T>
- All Superinterfaces:
AutoCloseable,Closeable,CloseableIterator<T>,Iterator<T>
Like
CloseableIterator, but has a currentMetadata() method, which returns "metadata", which is effectively a Mapinvalid input: '<'String, Object>
about 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 via IntermediateRowParsingReader.source() method and needn't be included-
Method Summary
Modifier and TypeMethodDescriptionstatic <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, mapMethods inherited from interface java.util.Iterator
forEachRemaining, hasNext, next, remove
-
Method Details
-
currentMetadata
- Returns:
- A map containing the information about the source of the last value returned by
Iterator.next()
-
withEmptyMetadata
Creates an instance of CloseableIteratorWithMetadata from aCloseableIterator.currentMetadata()for the instance is guaranteed to return an empty map
-