Class TextReader
java.lang.Object
org.apache.drill.exec.store.easy.text.reader.TextReader
- All Implemented Interfaces:
AutoCloseable
A byte-based Text parser implementation. Builds heavily upon the uniVocity
parsers. Customized for UTF8 parsing and DrillBuf support.
-
Constructor Summary
ConstructorDescriptionTextReader
(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 byTextParsingSettings
, and requires this configuration to be properly initialized. -
Method Summary
Modifier and TypeMethodDescriptionvoid
appendIgnoringWhitespace
(byte data) void
close()
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 batchorg.apache.drill.exec.store.easy.text.reader.TextOutput
long
getPos()
final boolean
Parses the next record from the input.void
Inform the output interface to indicate we are starting a new record batchfinal void
start()
Starting point for the reader.
-
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 byTextParsingSettings
, and requires this configuration to be properly initialized.- Parameters:
settings
- the parser configurationinput
- input streamoutput
- interface to produce output record batchworkBuf
- 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
Starting point for the reader. Sets up the input interface.- Throws:
IOException
- for input file read errors
-
parseNext
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
Invoked once there are no more records and we are done with the current record reader to clean up state.- Specified by:
close
in interfaceAutoCloseable
- Throws:
IOException
- for input file read errors
-