Package org.apache.druid.segment
Interface TimeAndDimsIterator
-
- All Superinterfaces:
AutoCloseable
,Closeable
- All Known Subinterfaces:
RowIterator
,TransformableRowIterator
- All Known Implementing Classes:
ForwardingRowIterator
public interface TimeAndDimsIterator extends Closeable
TimeAndDimsIterator (in conjunction withTimeAndDimsPointer
) is anIterator
-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
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
close()
Closes any resources, associated with this iterator.TimeAndDimsPointer
getPointer()
Returns a pointer to the current data point.boolean
moveToNext()
Moves iterator to the next data point.
-
-
-
Method Detail
-
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 {@link true}. This method must not be called before ever calling tomoveToNext()
. 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:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
-
-