Class LineRecordReader

    • Field Detail

      • locations

        protected URI[] locations
      • splitIndex

        protected int splitIndex
      • lineIndex

        protected int lineIndex
      • initialized

        protected boolean initialized
      • charset

        protected String charset
    • Constructor Detail

      • LineRecordReader

        public LineRecordReader()
    • Method Detail

      • hasNext

        public boolean hasNext()
        Description copied from interface: RecordReader
        Whether there are anymore records
        Returns:
      • onLocationOpen

        protected void onLocationOpen​(URI location)
      • setConf

        public void setConf​(Configuration conf)
        Description copied from interface: Configurable
        Set the configuration to be used by this object.
      • getConf

        public Configuration getConf()
        Description copied from interface: Configurable
        Return the configuration used by this object.
      • getLabels

        public List<String> getLabels()
        Description copied from interface: RecordReader
        List of label strings
        Returns:
      • reset

        public void reset()
        Description copied from interface: RecordReader
        Reset record reader iterator
      • resetSupported

        public boolean resetSupported()
        Returns:
        True if the record reader can be reset, false otherwise. Note that some record readers cannot be reset - for example, if they are backed by a non-resettable input split (such as certain types of streams)
      • record

        public List<Writable> record​(URI uri,
                                     DataInputStream dataInputStream)
                              throws IOException
        Description copied from interface: RecordReader
        Load the record from the given DataInputStream Unlike RecordReader.next() the internal state of the RecordReader is not modified Implementations of this method should not close the DataInputStream
        Throws:
        IOException - if error occurs during reading from the input stream
      • getIterator

        protected Iterator<String> getIterator​(int location)
      • closeIfRequired

        protected void closeIfRequired​(Iterator<String> iterator)
      • nextRecord

        public Record nextRecord()
        Description copied from interface: RecordReader
        Similar to RecordReader.next(), but returns a Record object, that may include metadata such as the source of the data
        Returns:
        next record
      • loadFromMetaData

        public Record loadFromMetaData​(RecordMetaData recordMetaData)
                                throws IOException
        Description copied from interface: RecordReader
        Load a single record from the given RecordMetaData instance
        Note: that for data that isn't splittable (i.e., text data that needs to be scanned/split), it is more efficient to load multiple records at once using RecordReader.loadFromMetaData(List)
        Parameters:
        recordMetaData - Metadata for the record that we want to load from
        Returns:
        Single record for the given RecordMetaData instance
        Throws:
        IOException - If I/O error occurs during loading
      • loadFromMetaData

        public List<Record> loadFromMetaData​(List<RecordMetaData> recordMetaDatas)
                                      throws IOException
        Description copied from interface: RecordReader
        Load multiple records from the given a list of RecordMetaData instances
        Parameters:
        recordMetaDatas - Metadata for the records that we want to load from
        Returns:
        Multiple records for the given RecordMetaData instances
        Throws:
        IOException - If I/O error occurs during loading