Class foreign_storage::RegexFileBufferParser

class RegexFileBufferParser : public foreign_storage::TextFileBufferParser

Public Functions

RegexFileBufferParser(const ForeignTable *foreign_table)
ParseBufferResult parseBuffer(ParseBufferRequest &request, bool convert_data_blocks, bool columns_are_pre_filtered = false) const

Parses a given file buffer and returns data blocks for each column in the file along with metadata related to rows and row offsets within the buffer.

import_export::CopyParams validateAndGetCopyParams(const ForeignTable *foreign_table) const

Validates foreign table parse options and returns a CopyParams object upon successful validation. An exception is thrown if validation fails.

size_t findRowEndPosition(size_t &alloc_size, std::unique_ptr<char[]> &buffer, size_t &buffer_size, const import_export::CopyParams &copy_params, const size_t buffer_first_row_index, unsigned int &num_rows_in_buffer, FileReader *file_reader) const

Finds and returns the offset of the end of the last row in the given buffer. If the buffer does not contain at least one row, the buffer is extended with more content from the file until a row is read. An exception is thrown if the buffer is extended to a maximum threshold and at least one row has still not been read.

void validateFiles(const FileReader *file_reader, const ForeignTable *foreign_table) const

Performs basic validation of files to be parsed.

Public Static Functions

void setMaxBufferResize(size_t max_buffer_resize)

Public Static Attributes

const std::string LINE_REGEX_KEY = "LINE_REGEX"
const std::string LINE_START_REGEX_KEY = "LINE_START_REGEX"
const std::string BUFFER_SIZE_KEY = "BUFFER_SIZE"
const std::string HEADER_KEY = "HEADER"

Private Members

boost::regex line_regex_
std::optional<boost::regex> line_start_regex_

Private Static Functions

size_t getMaxBufferResize()

Private Static Attributes

size_t max_buffer_resize_{import_export::max_import_buffer_resize_byte_size}
bool skip_first_line_ = {false}