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
ConstructorsConstructorDescriptionTextReader(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 TypeMethodDescriptionvoidappendIgnoringWhitespace(byte data) voidclose()Invoked once there are no more records and we are done with the current record reader to clean up state.voidFinish the processing of a batch, indicates to the output interface to wrap up the batchorg.apache.drill.exec.store.easy.text.reader.TextOutputlonggetPos()final booleanParses the next record from the input.voidInform the output interface to indicate we are starting a new record batchfinal voidstart()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:
closein interfaceAutoCloseable- Throws:
IOException- for input file read errors
-