public interface RowIterator extends TimeAndDimsIterator
TimeAndDimsIterator, specialized for RowPointer instead of TimeAndDimsPointer.
Also, RowIterator encapsulates tracking of data point changes between TimeAndDimsIterator.moveToNext() calls via mark()
and hasTimeAndDimsChangedSinceMark() methods. This functionality is used in RowCombiningTimeAndDimsIterator, and also internally in MergingRowIterator to reduce the number of
comparisons that this class makes. This functionality is added directly to RowIterator interface rather than
left to be implemented externally to this interface, because it's inefficient to do the latter with "generic"
RowIterator, because of TimeAndDimsPointer allocation-free design, that reuses objects. On the other hand,
some implementations of RowIterator allow to optimize mark() and hasTimeAndDimsChangedSinceMark().| Modifier and Type | Method and Description |
|---|---|
RowPointer |
getPointer()
Returns a pointer to the current row.
|
boolean |
hasTimeAndDimsChangedSinceMark()
Compares the "memoized" data point from the last
mark() call with the data point, to which getPointer() currently points. |
void |
mark()
"Memoizes" the data point, to which
getPointer() currently points. |
close, moveToNextvoid mark()
getPointer() currently points. If the last call to TimeAndDimsIterator.moveToNext() returned false, the behaviour of this method is undefined, e. g. it may throw a runtime
exception.boolean hasTimeAndDimsChangedSinceMark()
mark() call with the data point, to which getPointer() currently points. Comparison is made in terms of TimeAndDimsPointer.compareTo(org.apache.druid.segment.TimeAndDimsPointer) contract.
If mark() has never been called, or the last call to TimeAndDimsIterator.moveToNext() returned false, the
behaviour of this method is undefined: it may arbitrarily return true, or false, or throw a runtime exception.RowPointer getPointer()
TimeAndDimsIterator.moveToNext() call that returns true.
This method must not be called before ever calling to TimeAndDimsIterator.moveToNext(). If the very first call to TimeAndDimsIterator.moveToNext() returned false, the behaviour of this method is undefined (it may return a "wrong" pointer,
null, throw an exception, etc.).
If TimeAndDimsIterator.moveToNext() returned true one or more times, and then eventually returned false,
calling getPointer() after that should return a pointer pointing to the last valid row, as if getPointer() was called before the last (unsuccessful) call to TimeAndDimsIterator.moveToNext(). In other words, unsuccessful
TimeAndDimsIterator.moveToNext() call doesn't "corrupt" the pointer. This property is used in RowCombiningTimeAndDimsIterator.moveToNext().getPointer in interface TimeAndDimsIteratorCopyright © 2011–2023 The Apache Software Foundation. All rights reserved.