OmniSciDB
a5dc49c757
|
#include <CsvFileBufferParser.h>
Public Member Functions | |
ParseBufferResult | parseBuffer (ParseBufferRequest &request, bool convert_data_blocks, bool columns_are_pre_filtered=false, bool skip_dict_encoding=false) const override |
import_export::CopyParams | validateAndGetCopyParams (const ForeignTable *foreign_table) const override |
size_t | findRowEndPosition (size_t &alloc_size, std::unique_ptr< char[]> &buffer, size_t &buffer_size, const import_export::CopyParams ©_params, const size_t buffer_first_row_index, unsigned int &num_rows_in_buffer, foreign_storage::FileReader *file_reader) const override |
void | validateExpectedColumnCount (const std::string &row, const import_export::CopyParams ©_params, size_t num_cols, int point_cols, const std::string &file_name) const |
void | validateFiles (const FileReader *file_reader, const ForeignTable *foreign_table) const override |
Static Public Attributes | |
static const std::string | DELIMITER_KEY = "DELIMITER" |
static const std::string | NULLS_KEY = "NULLS" |
static const std::string | HEADER_KEY = "HEADER" |
static const std::string | QUOTED_KEY = "QUOTED" |
static const std::string | QUOTE_KEY = "QUOTE" |
static const std::string | ESCAPE_KEY = "ESCAPE" |
static const std::string | LINE_DELIMITER_KEY = "LINE_DELIMITER" |
static const std::string | ARRAY_DELIMITER_KEY = "ARRAY_DELIMITER" |
static const std::string | ARRAY_MARKER_KEY = "ARRAY_MARKER" |
static const std::string | LONLAT_KEY = "LONLAT" |
static const std::string | GEO_EXPLODE_COLLECTIONS_KEY = "GEO_EXPLODE_COLLECTIONS" |
static const std::string | SOURCE_SRID_KEY = "SOURCE_SRID" |
static const std::string | TRIM_SPACES_KEY = "TRIM_SPACES" |
Static Public Attributes inherited from foreign_storage::TextFileBufferParser | |
static const std::string | BUFFER_SIZE_KEY = "BUFFER_SIZE" |
Additional Inherited Members | |
Static Public Member Functions inherited from foreign_storage::TextFileBufferParser | |
static std::map< int, DataBlockPtr > | convertImportBuffersToDataBlocks (const std::vector< std::unique_ptr< import_export::TypedImportBuffer >> &import_buffers, const bool skip_dict_encoding=false) |
static bool | isCoordinateScalar (const std::string_view datum) |
static void | processGeoColumn (std::vector< std::unique_ptr< import_export::TypedImportBuffer >> &import_buffers, size_t &col_idx, const import_export::CopyParams ©_params, std::list< const ColumnDescriptor * >::iterator &cd_it, std::vector< std::string_view > &row, size_t &import_idx, bool is_null, size_t first_row_index, size_t row_index_plus_one, std::shared_ptr< Catalog_Namespace::Catalog > catalog) |
static void | fillRejectedRowWithInvalidData (const std::list< const ColumnDescriptor * > &columns, std::list< const ColumnDescriptor * >::iterator &cd_it, const size_t col_idx, ParseBufferRequest &request) |
static bool | isNullDatum (const std::string_view datum, const ColumnDescriptor *column, const std::string &null_indicator) |
Definition at line 22 of file CsvFileBufferParser.h.
|
overridevirtual |
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.
Implements foreign_storage::TextFileBufferParser.
Definition at line 408 of file CsvFileBufferParser.cpp.
References import_export::delimited_parser::find_row_end_pos().
|
overridevirtual |
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.
Implements foreign_storage::TextFileBufferParser.
Definition at line 122 of file CsvFileBufferParser.cpp.
References foreign_storage::ParseBufferRequest::begin_pos, foreign_storage::ParseBufferRequest::buffer, foreign_storage::ParseBufferRequest::buffer_size, CHECK, foreign_storage::TextFileBufferParser::convertImportBuffersToDataBlocks(), foreign_storage::ParseBufferRequest::copy_params, foreign_storage::ParseBufferRequest::end_pos, foreign_storage::ParseBufferRequest::file_offset, foreign_storage::TextFileBufferParser::fillRejectedRowWithInvalidData(), import_export::delimited_parser::find_beginning(), foreign_storage::ParseBufferRequest::first_row_index, foreign_storage::ParseBufferRequest::foreign_table_schema, import_export::delimited_parser::get_row(), foreign_storage::ParseBufferRequest::getCatalog(), foreign_storage::ParseBufferRequest::getColumns(), foreign_storage::ParseBufferRequest::getFilePath(), foreign_storage::ParseBufferRequest::import_buffers, is_null(), foreign_storage::TextFileBufferParser::isCoordinateScalar(), foreign_storage::TextFileBufferParser::isNullDatum(), kPOINT, import_export::CopyParams::null_str, foreign_storage::ParseBufferRequest::process_row_count, foreign_storage::TextFileBufferParser::processGeoColumn(), run_benchmark_import::result, foreign_storage::anonymous_namespace{CsvFileBufferParser.cpp}::set_array_flags_and_geo_columns_count(), foreign_storage::anonymous_namespace{CsvFileBufferParser.cpp}::skip_column_import(), sv_strip(), foreign_storage::ParseBufferRequest::track_rejected_rows, import_export::CopyParams::trim_spaces, and foreign_storage::anonymous_namespace{CsvFileBufferParser.cpp}::validate_expected_column_count().
|
overridevirtual |
Validates foreign table parse options and returns a CopyParams object upon successful validation. An exception is thrown if validation fails.
Implements foreign_storage::TextFileBufferParser.
Definition at line 334 of file CsvFileBufferParser.cpp.
References ARRAY_DELIMITER_KEY, ARRAY_MARKER_KEY, foreign_storage::TextFileBufferParser::BUFFER_SIZE_KEY, DELIMITER_KEY, ESCAPE_KEY, GEO_EXPLODE_COLLECTIONS_KEY, foreign_storage::ForeignTable::GEO_VALIDATE_GEOMETRY_KEY, HEADER_KEY, import_export::kHasHeader, import_export::kNoHeader, LINE_DELIMITER_KEY, LONLAT_KEY, NULLS_KEY, foreign_storage::OptionsContainer::options, import_export::CopyParams::plain_text, QUOTE_KEY, QUOTED_KEY, SOURCE_SRID_KEY, foreign_storage::AbstractFileStorageDataWrapper::THREADS_KEY, TRIM_SPACES_KEY, foreign_storage::anonymous_namespace{CsvFileBufferParser.cpp}::validate_and_get_bool_value(), foreign_storage::anonymous_namespace{CsvFileBufferParser.cpp}::validate_and_get_delimiter(), and foreign_storage::anonymous_namespace{CsvFileBufferParser.cpp}::validate_and_get_string_with_length().
Referenced by foreign_storage::CsvDataWrapper::validateTableOptions().
void foreign_storage::CsvFileBufferParser::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)
Definition at line 309 of file CsvFileBufferParser.cpp.
References import_export::delimited_parser::get_row(), and foreign_storage::anonymous_namespace{CsvFileBufferParser.cpp}::validate_expected_column_count().
|
inlineoverridevirtual |
Performs basic validation of files to be parsed.
Implements foreign_storage::TextFileBufferParser.
Definition at line 46 of file CsvFileBufferParser.h.
|
inlinestatic |
Definition at line 57 of file CsvFileBufferParser.h.
Referenced by foreign_storage::ForeignDataWrapperFactory::createForeignTableProxy(), and validateAndGetCopyParams().
|
inlinestatic |
Definition at line 58 of file CsvFileBufferParser.h.
Referenced by foreign_storage::ForeignDataWrapperFactory::createForeignTableProxy(), and validateAndGetCopyParams().
|
inlinestatic |
Definition at line 50 of file CsvFileBufferParser.h.
Referenced by foreign_storage::ForeignDataWrapperFactory::createForeignTableProxy(), and validateAndGetCopyParams().
|
inlinestatic |
Definition at line 55 of file CsvFileBufferParser.h.
Referenced by foreign_storage::ForeignDataWrapperFactory::createForeignTableProxy(), and validateAndGetCopyParams().
|
inlinestatic |
Definition at line 60 of file CsvFileBufferParser.h.
Referenced by foreign_storage::ForeignDataWrapperFactory::createForeignTableProxy(), and validateAndGetCopyParams().
|
inlinestatic |
Definition at line 52 of file CsvFileBufferParser.h.
Referenced by foreign_storage::anonymous_namespace{ForeignDataWrapperFactory.cpp}::set_header_option(), and validateAndGetCopyParams().
|
inlinestatic |
Definition at line 56 of file CsvFileBufferParser.h.
Referenced by foreign_storage::ForeignDataWrapperFactory::createForeignTableProxy(), and validateAndGetCopyParams().
|
inlinestatic |
Definition at line 59 of file CsvFileBufferParser.h.
Referenced by foreign_storage::ForeignDataWrapperFactory::createForeignTableProxy(), and validateAndGetCopyParams().
|
inlinestatic |
Definition at line 51 of file CsvFileBufferParser.h.
Referenced by foreign_storage::ForeignDataWrapperFactory::createForeignTableProxy(), and validateAndGetCopyParams().
|
inlinestatic |
Definition at line 54 of file CsvFileBufferParser.h.
Referenced by foreign_storage::ForeignDataWrapperFactory::createForeignTableProxy(), and validateAndGetCopyParams().
|
inlinestatic |
Definition at line 53 of file CsvFileBufferParser.h.
Referenced by foreign_storage::ForeignDataWrapperFactory::createForeignTableProxy(), and validateAndGetCopyParams().
|
inlinestatic |
Definition at line 61 of file CsvFileBufferParser.h.
Referenced by foreign_storage::ForeignDataWrapperFactory::createForeignTableProxy(), and validateAndGetCopyParams().
|
inlinestatic |
Definition at line 62 of file CsvFileBufferParser.h.
Referenced by foreign_storage::ForeignDataWrapperFactory::createForeignTableProxy(), and validateAndGetCopyParams().