Package org.apache.druid.segment
Interface TimeAndDimsIterator
- All Superinterfaces:
AutoCloseable,Closeable
- All Known Subinterfaces:
RowIterator,TransformableRowIterator
- All Known Implementing Classes:
ForwardingRowIterator
TimeAndDimsIterator (in conjunction with
TimeAndDimsPointer) is an Iterator-like
abstraction, designed for allocation-free transformation, merging, combining and iteration over a stream of data
points.
Usage pattern:
try (TimeAndDimsIterator iterator = obtainNewTimeAndDimsIteratorFromSomewhere()) {
while (iterator.moveToNext()) {
TimeAndDimsPointer pointer = iterator.getPointer();
doSomethingWithPointer(pointer);
}
}-
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Closes any resources, associated with this iterator.Returns a pointer to the current data point.booleanMoves iterator to the next data point.
-
Method Details
-
moveToNext
boolean moveToNext()Moves iterator to the next data point. This method must be called before the first use ofgetPointer(). As long as this method returnstrue,getPointer()could be safely called; after this method returnedfalse, this iterator is done,getPointer()must _not_ be called, andclose()should be called. -
getPointer
TimeAndDimsPointer getPointer()Returns a pointer to the current data point. This method may return the same (in terms of referencial identity), as well as different object on any calls, but the data point itself, to which the returned object points, changes after eachmoveToNext()call that returns}. This method must not be called before ever calling toinvalid @link
{@link truemoveToNext(). After a call tomoveToNext()returnedfalse, the behaviour of this method is undefined (it may return a "wrong" pointer, null, throw an exception, etc.) -
close
void close()Closes any resources, associated with this iterator.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable
-