Public Member Functions | |
| virtual void | destroy (ServerInterface &srvInterface, SizedColumnTypes &returnType) |
| virtual StreamState | process (ServerInterface &srvInterface, DataBuffer &input, InputState input_state)=0 |
| virtual void | setup (ServerInterface &srvInterface, SizedColumnTypes &returnType) |
| virtual | ~UDChunker () |
Class that allows the separation of parsing record boundaries, which in some cases cannot be parallelized, from parsing "column" values, which is typically the bottleneck and which, thankfully, can usually be parallelized.
| virtual Vertica::UDChunker::~UDChunker | ( | ) | [inline, virtual] |
Dtor.
| virtual void Vertica::UDChunker::destroy | ( | ServerInterface & | srvInterface, | |
| SizedColumnTypes & | returnType | |||
| ) | [inline, virtual] |
Will be invoked during query execution, after the last time that process() is called on this UDChunker instance for a particular input.
May optionally be overridden to perform tear-down/destruction.
See UDChunker::setup() for a note about the restartability of UDChunkers.
| virtual StreamState Vertica::UDChunker::process | ( | ServerInterface & | srvInterface, | |
| DataBuffer & | input, | |||
| InputState | input_state | |||
| ) | [pure virtual] |
Will be invoked repeatedly during query execution, until it returns DONE or until the query is canceled by the user.
On each invocation, process() will be given an input buffer. It should read data from that buffer, find record boundaries and align input.offset with the end of the last record in the buffer. Once it has processed as much as it reasonably can (for example, once it has processed the last complete row in the input buffer), it should return INPUT_NEEDED to indicate that more data is needed, or DONE to indicate that it has completed "parsing" this input stream and will not be reading more bytes from it.
if a few rows were found in current block, move offset forward to point at the start of next (potential) row, and mark state as CHUNK_ALIGNED, indicating the chunker is ready to hand this chunk to parser.
If `input_state` == END_OF_FILE, then the last byte in `input` is the last byte in the input stream. Returning INPUT_NEEDED will not result in any new input appearing. process() should return DONE in this case.
Note that `input` may contain null bytes, if the source file contains null bytes. Note also that `input` is NOT automatically null-terminated.
process() must not block indefinitely. If it cannot proceed for an extended period of time, it should return KEEP_GOING. It will be called again shortly. Failure to do this will, among other things, prevent the query from being canceled by the user.
| virtual void Vertica::UDChunker::setup | ( | ServerInterface & | srvInterface, | |
| SizedColumnTypes & | returnType | |||
| ) | [inline, virtual] |
Will be invoked during query execution, prior to the first time that process() is called on this UDChunker instance for a particular input source.
May optionally be overridden to perform setup/initialzation.
Note that UDChunkers MUST BE RESTARTABLE! If loading large numbers of files, a given UDChunker may be re-used for multiple files. Vertica follows the worker-pool design pattern: At the start of COPY execution, several Chunkers and several Filters are instantiated per node, by calling the corresponding prepare() method multiple times. Each Filter/Chunker pair is then internally assigned to an initial Source (UDSource or internal). At that point, setup() is called; then process() is called until it is finished; then destroy() is called. If there are still sources in the pool waiting to be processed, then the UDFilter/UDChunker pair will be given a second Source; setup() will be called a second time, then process() until it is finished, then destroy(). This repeats until all sources have been read.