Class PinotSegmentRecordReader
- java.lang.Object
-
- org.apache.pinot.segment.local.segment.readers.PinotSegmentRecordReader
-
- All Implemented Interfaces:
Closeable,Serializable,AutoCloseable,RecordReader
public class PinotSegmentRecordReader extends Object implements RecordReader
Record reader for Pinot segment.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description PinotSegmentRecordReader()PinotSegmentRecordReader(File indexDir)Deprecated.PinotSegmentRecordReader(File indexDir, Schema schema, List<String> sortOrder)Deprecated.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()voidgetRecord(GenericRow reuse, int docId)int[]getSortedDocIds()Returns the sorted document ids.ObjectgetValue(int docId, String column)booleanhasNext()voidinit(File indexDir, Set<String> fieldsToRead, List<String> sortOrder, boolean skipDefaultNullValues)Initializes the record reader from an index directory.voidinit(File indexDir, Set<String> fieldsToRead, RecordReaderConfig recordReaderConfig)voidinit(ImmutableSegment immutableSegment)Initializes the record reader from an immutable segment.voidinit(MutableSegment mutableSegment, int[] sortedDocIds)Initializes the record reader from a mutable segment.GenericRownext()GenericRownext(GenericRow reuse)voidrewind()
-
-
-
Constructor Detail
-
PinotSegmentRecordReader
public PinotSegmentRecordReader()
-
PinotSegmentRecordReader
@Deprecated public PinotSegmentRecordReader(File indexDir) throws Exception
Deprecated.Deprecated: use empty constructor and init() instead. Read records using the segment schema- Parameters:
indexDir- input path for the segment index- Throws:
Exception
-
PinotSegmentRecordReader
@Deprecated public PinotSegmentRecordReader(File indexDir, @Nullable Schema schema, @Nullable List<String> sortOrder) throws Exception
Deprecated.Deprecated: use empty constructor and init() instead. Read records using the segment schema with the given schema and sort orderPassed in schema must be a subset of the segment schema.
- Parameters:
indexDir- input path for the segment indexschema- input schema that is a subset of the segment schemasortOrder- a list of column names that represent the sorting order- Throws:
Exception
-
-
Method Detail
-
init
public void init(File indexDir, @Nullable Set<String> fieldsToRead, @Nullable RecordReaderConfig recordReaderConfig)
- Specified by:
initin interfaceRecordReader
-
init
public void init(File indexDir, @Nullable Set<String> fieldsToRead, @Nullable List<String> sortOrder, boolean skipDefaultNullValues)
Initializes the record reader from an index directory.- Parameters:
indexDir- Index directoryfieldsToRead- The fields to read from the segment. If null or empty, reads all fieldssortOrder- List of sorted columnsskipDefaultNullValues- Whether to skip putting default null values into the record
-
init
public void init(ImmutableSegment immutableSegment)
Initializes the record reader from an immutable segment.- Parameters:
immutableSegment- Immutable segment
-
init
public void init(MutableSegment mutableSegment, @Nullable int[] sortedDocIds)
Initializes the record reader from a mutable segment. NOTE: The mutable segment should have already finished consumption and ready to be sealed. In order to read records from consuming segment, useIndexSegment.getRecord(int, GenericRow)instead.- Parameters:
mutableSegment- Mutable segmentsortedDocIds- Array of sorted document ids
-
getSortedDocIds
@Nullable public int[] getSortedDocIds()
Returns the sorted document ids.
-
hasNext
public boolean hasNext()
- Specified by:
hasNextin interfaceRecordReader
-
next
public GenericRow next()
- Specified by:
nextin interfaceRecordReader
-
next
public GenericRow next(GenericRow reuse)
- Specified by:
nextin interfaceRecordReader
-
getRecord
public void getRecord(GenericRow reuse, int docId)
-
rewind
public void rewind()
- Specified by:
rewindin interfaceRecordReader
-
close
public void close() throws IOException- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException
-
-