Package org.apache.druid.segment
Class ForwardingRowIterator
java.lang.Object
org.apache.druid.segment.ForwardingRowIterator
- All Implemented Interfaces:
Closeable,AutoCloseable,RowIterator,TimeAndDimsIterator,TransformableRowIterator
Implementation of
TransformableRowIterator that just delegates all methods to some baseIterator (adapter
pattern). Subclass should override some methods.-
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedForwardingRowIterator(TransformableRowIterator baseIterator) -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Closes any resources, associated with this iterator.Returns a pointer to the row, that was the current row whenRowIterator.mark()was called for the last time.Returns a pointer to the current row.booleanCompares the "memoized" data point from the lastRowIterator.mark()call with the data point, to whichRowIterator.getPointer()currently points.voidmark()"Memoizes" the data point, to whichRowIterator.getPointer()currently points.booleanMoves iterator to the next data point.
-
Field Details
-
baseIterator
-
-
Constructor Details
-
ForwardingRowIterator
-
-
Method Details
-
mark
public void mark()Description copied from interface:RowIterator"Memoizes" the data point, to whichRowIterator.getPointer()currently points. If the last call toTimeAndDimsIterator.moveToNext()returnedfalse, the behaviour of this method is undefined, e. g. it may throw a runtime exception.- Specified by:
markin interfaceRowIterator
-
getMarkedPointer
Description copied from interface:TransformableRowIteratorReturns a pointer to the row, that was the current row whenRowIterator.mark()was called for the last time. This method always returns the same object, but pointing to different rows after eachRowIterator.mark()call. This method must not be called before ever calling toTimeAndDimsIterator.moveToNext(). If the very first call toTimeAndDimsIterator.moveToNext()returnedfalse, the behaviour of this method is undefined (it may return a "wrong" pointer, null, throw an exception, etc.). This method could be called before the first call toRowIterator.mark()(it should return the same object as it is required to return after all subsequentRowIterator.mark()calls), but the data of the returned pointer should not be accessed before the first call toRowIterator.mark(). This method is used inRowCombiningTimeAndDimsIteratorimplementation. getMarkedPointer() returnsTimeAndDimsPointerinstead ofRowPointer(likeTransformableRowIterator.getPointer()) merely becauseRowCombiningTimeAndDimsIteratordoesn't need this method to return anything more specific thanTimeAndDimsPointer.- Specified by:
getMarkedPointerin interfaceTransformableRowIterator
-
hasTimeAndDimsChangedSinceMark
public boolean hasTimeAndDimsChangedSinceMark()Description copied from interface:RowIteratorCompares the "memoized" data point from the lastRowIterator.mark()call with the data point, to whichRowIterator.getPointer()currently points. Comparison is made in terms ofTimeAndDimsPointer.compareTo(org.apache.druid.segment.TimeAndDimsPointer)contract. IfRowIterator.mark()has never been called, or the last call toTimeAndDimsIterator.moveToNext()returnedfalse, the behaviour of this method is undefined: it may arbitrarily return true, or false, or throw a runtime exception.- Specified by:
hasTimeAndDimsChangedSinceMarkin interfaceRowIterator
-
getPointer
Description copied from interface:TransformableRowIteratorReturns a pointer to the current row. This method _always returns the same object_, but pointing to different row after eachTimeAndDimsIterator.moveToNext()call that returns {@link true}. Other aspects of the behaviour of this method are the same as in the genericRowIterator.getPointer()contract.- Specified by:
getPointerin interfaceRowIterator- Specified by:
getPointerin interfaceTimeAndDimsIterator- Specified by:
getPointerin interfaceTransformableRowIterator
-
moveToNext
public boolean moveToNext()Description copied from interface:TimeAndDimsIteratorMoves iterator to the next data point. This method must be called before the first use ofTimeAndDimsIterator.getPointer(). As long as this method returnstrue,TimeAndDimsIterator.getPointer()could be safely called; after this method returnedfalse, this iterator is done,TimeAndDimsIterator.getPointer()must _not_ be called, andTimeAndDimsIterator.close()should be called.- Specified by:
moveToNextin interfaceTimeAndDimsIterator
-
close
public void close()Description copied from interface:TimeAndDimsIteratorCloses any resources, associated with this iterator.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein interfaceTimeAndDimsIterator
-