java.lang.Object
org.apache.drill.exec.store.easy.text.reader.TextReader
All Implemented Interfaces:
AutoCloseable

public final class TextReader extends Object implements AutoCloseable
A byte-based Text parser implementation. Builds heavily upon the uniVocity parsers. Customized for UTF8 parsing and DrillBuf support.
  • Constructor Summary

    Constructors
    Constructor
    Description
    TextReader(TextParsingSettings settings, org.apache.drill.exec.store.easy.text.reader.TextInput input, org.apache.drill.exec.store.easy.text.reader.TextOutput output, DrillBuf workBuf)
    The CsvParser supports all settings provided by TextParsingSettings, and requires this configuration to be properly initialized.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
     
    void
    Invoked once there are no more records and we are done with the current record reader to clean up state.
    void
    Finish the processing of a batch, indicates to the output interface to wrap up the batch
    org.apache.drill.exec.store.easy.text.reader.TextOutput
     
    long
     
    final boolean
    Parses the next record from the input.
    void
    Inform the output interface to indicate we are starting a new record batch
    final void
    Starting point for the reader.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • TextReader

      public TextReader(TextParsingSettings settings, org.apache.drill.exec.store.easy.text.reader.TextInput input, org.apache.drill.exec.store.easy.text.reader.TextOutput output, DrillBuf workBuf)
      The CsvParser supports all settings provided by TextParsingSettings, and requires this configuration to be properly initialized.
      Parameters:
      settings - the parser configuration
      input - input stream
      output - interface to produce output record batch
      workBuf - working buffer to handle whitespace
  • Method Details

    • getOutput

      public org.apache.drill.exec.store.easy.text.reader.TextOutput getOutput()
    • resetForNextBatch

      public void resetForNextBatch()
      Inform the output interface to indicate we are starting a new record batch
    • getPos

      public long getPos()
    • appendIgnoringWhitespace

      public void appendIgnoringWhitespace(byte data)
    • start

      public final void start() throws IOException
      Starting point for the reader. Sets up the input interface.
      Throws:
      IOException - for input file read errors
    • parseNext

      public final boolean parseNext() throws IOException
      Parses the next record from the input. Will skip the line if its a comment, this is required when the file contains headers
      Throws:
      IOException - for input file read errors
    • finishBatch

      public void finishBatch()
      Finish the processing of a batch, indicates to the output interface to wrap up the batch
    • close

      public void close() throws IOException
      Invoked once there are no more records and we are done with the current record reader to clean up state.
      Specified by:
      close in interface AutoCloseable
      Throws:
      IOException - for input file read errors