Interface RecordReader
-
- All Superinterfaces:
AutoCloseable,Closeable,Serializable
public interface RecordReader extends Closeable, Serializable
TheRecordReaderinterface is used to read records from various file formats intoGenericRows. Pinot segments will be generated fromGenericRows.NOTE: for time column, record reader should be able to read both incoming and outgoing time
-
-
Method Summary
Modifier and Type Method Description booleanhasNext()Returntrueif more records remain to be read.voidinit(File dataFile, Set<String> fieldsToRead, RecordReaderConfig recordReaderConfig)Initializes the record reader with data file, schema and (optional) record reader config.GenericRownext()Get the next record.GenericRownext(GenericRow reuse)Get the next record.voidrewind()Rewind the reader to start reading from the first record again.
-
-
-
Method Detail
-
init
void init(File dataFile, @Nullable Set<String> fieldsToRead, @Nullable RecordReaderConfig recordReaderConfig) throws IOException
Initializes the record reader with data file, schema and (optional) record reader config.- Parameters:
dataFile- Data filefieldsToRead- The fields to read from the data file. If null or empty, reads all fieldsrecordReaderConfig- Config for the reader specific to the format. e.g. delimiter for csv format etc- Throws:
IOException- If an I/O error occurs
-
hasNext
boolean hasNext()
Returntrueif more records remain to be read.
-
next
GenericRow next() throws IOException
Get the next record. TODO: Add default implementation because all the override implementations are the same- Throws:
IOException
-
next
GenericRow next(GenericRow reuse) throws IOException
Get the next record. Re-use the given row to reduce garbage.The passed in row should be cleared before calling this method. TODO: Consider clearing the row within the record reader to simplify the caller
- Throws:
IOException
-
rewind
void rewind() throws IOExceptionRewind the reader to start reading from the first record again.- Throws:
IOException
-
-