Class foreign_storage::CsvFileBufferParser

class CsvFileBufferParser : public foreign_storage::TextFileBufferParser

Public Functions

ParseBufferResult parseBuffer(ParseBufferRequest &request, bool convert_data_blocks, bool columns_are_pre_filtered = false) const

Parses a given CSV 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, foreign_storage::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 validateExpectedColumnCount(const std::string &row, const import_export::CopyParams &copy_params, size_t num_cols, int point_cols, const std::string &file_name) const

Takes a single row and verifies number of columns is valid for num_cols and point_cols (number of point columns)

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

Performs basic validation of files to be parsed.

Public Static Attributes

const std::string DELIMITER_KEY = "DELIMITER"
const std::string NULLS_KEY = "NULLS"
const std::string HEADER_KEY = "HEADER"
const std::string QUOTED_KEY = "QUOTED"
const std::string QUOTE_KEY = "QUOTE"
const std::string ESCAPE_KEY = "ESCAPE"
const std::string LINE_DELIMITER_KEY = "LINE_DELIMITER"
const std::string ARRAY_DELIMITER_KEY = "ARRAY_DELIMITER"
const std::string ARRAY_MARKER_KEY = "ARRAY_MARKER"
const std::string LONLAT_KEY = "LONLAT"
const std::string GEO_ASSIGN_RENDER_GROUPS_KEY = "GEO_ASSIGN_RENDER_GROUPS"
const std::string GEO_EXPLODE_COLLECTIONS_KEY = "GEO_EXPLODE_COLLECTIONS"
const std::string BUFFER_SIZE_KEY = "BUFFER_SIZE"