Interface RecordReader

    • Method Summary

      Modifier and Type Method Description
      boolean hasNext()
      Return true if more records remain to be read.
      void init​(File dataFile, Set<String> fieldsToRead, RecordReaderConfig recordReaderConfig)
      Initializes the record reader with data file, schema and (optional) record reader config.
      GenericRow next()
      Get the next record.
      GenericRow next​(GenericRow reuse)
      Get the next record.
      void rewind()
      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 file
        fieldsToRead - The fields to read from the data file. If null or empty, reads all fields
        recordReaderConfig - 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()
        Return true if 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 IOException
        Rewind the reader to start reading from the first record again.
        Throws:
        IOException