Class PostingsReader
java.lang.Object
org.apache.cassandra.index.sai.disk.v1.postings.PostingsReader
- All Implemented Interfaces:
Closeable,AutoCloseable,OrdinalPostingList,PostingList
Reads, decompresses and decodes postings lists written by
PostingsWriter.
Holds exactly one posting block in memory at a time. Does binary search over skip table to find a postings block to load.
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from interface org.apache.cassandra.index.sai.postings.PostingList
PostingList.EmptyPostingList -
Field Summary
Fields inherited from interface org.apache.cassandra.index.sai.postings.PostingList
EMPTY, END_OF_STREAM, OFFSET_NOT_FOUND -
Constructor Summary
ConstructorsConstructorDescriptionPostingsReader(org.apache.lucene.store.IndexInput input, long summaryOffset, QueryEventListener.PostingListEventListener listener) PostingsReader(org.apache.lucene.store.IndexInput input, PostingsReader.BlocksSummary summary, QueryEventListener.PostingListEventListener listener) -
Method Summary
Modifier and TypeMethodDescriptionlongadvance(long targetRowID) Advances to the first row ID beyond the current that is greater than or equal to the target, and returns that row ID.voidclose()longlongRetrieves the next segment row ID, not including row IDs that have been returned byPostingList.advance(long).longsize()Returns the upper bound of postings in the list.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.cassandra.index.sai.postings.PostingList
maximum, minimum
-
Constructor Details
-
PostingsReader
public PostingsReader(org.apache.lucene.store.IndexInput input, long summaryOffset, QueryEventListener.PostingListEventListener listener) throws IOException - Throws:
IOException
-
PostingsReader
public PostingsReader(org.apache.lucene.store.IndexInput input, PostingsReader.BlocksSummary summary, QueryEventListener.PostingListEventListener listener) throws IOException - Throws:
IOException
-
-
Method Details
-
getOrdinal
public long getOrdinal()- Specified by:
getOrdinalin interfaceOrdinalPostingList- Returns:
- the ordinal of the posting that will be returned on the next call to
PostingList.nextPosting()
-
close
public void close()- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein interfacePostingList
-
size
public long size()Description copied from interface:PostingListReturns the upper bound of postings in the list. During a merge individual postings may be de-duplicated, so we can't return the exact size only the upper bound of the size.- Specified by:
sizein interfacePostingList
-
advance
Advances to the first row ID beyond the current that is greater than or equal to the target, and returns that row ID. Exhausts the iterator and returnsPostingList.END_OF_STREAMif the target is greater than the highest row ID.Does binary search over the skip table to find the next block to load into memory.
Note: Callers must use the return value of this method before calling
nextPosting(), as calling that method will return the next posting, not the one to which we have just advanced.- Specified by:
advancein interfacePostingList- Parameters:
targetRowID- target row ID to advance to- Returns:
- first segment row ID which is >= the target row ID or
PostingList.END_OF_STREAMif one does not exist - Throws:
IOException
-
nextPosting
Description copied from interface:PostingListRetrieves the next segment row ID, not including row IDs that have been returned byPostingList.advance(long).- Specified by:
nextPostingin interfacePostingList- Returns:
- next segment row ID
- Throws:
IOException
-