OmniSciDB  72c90bc290
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
CsvFileBufferParser.h
Go to the documentation of this file.
1 /*
2  * Copyright 2022 HEAVY.AI, Inc.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #pragma once
18 
20 
21 namespace foreign_storage {
23  public:
25  bool convert_data_blocks,
26  bool columns_are_pre_filtered = false,
27  bool skip_dict_encoding = false) const override;
28 
30  const ForeignTable* foreign_table) const override;
31 
32  size_t findRowEndPosition(size_t& alloc_size,
33  std::unique_ptr<char[]>& buffer,
34  size_t& buffer_size,
35  const import_export::CopyParams& copy_params,
36  const size_t buffer_first_row_index,
37  unsigned int& num_rows_in_buffer,
38  foreign_storage::FileReader* file_reader) const override;
39 
40  void validateExpectedColumnCount(const std::string& row,
41  const import_export::CopyParams& copy_params,
42  size_t num_cols,
43  int point_cols,
44  const std::string& file_name) const;
45 
46  void validateFiles(const FileReader* file_reader,
47  const ForeignTable* foreign_table) const override{};
48 
49  // @TODO(se) more?
50  inline static const std::string DELIMITER_KEY = "DELIMITER";
51  inline static const std::string NULLS_KEY = "NULLS";
52  inline static const std::string HEADER_KEY = "HEADER";
53  inline static const std::string QUOTED_KEY = "QUOTED";
54  inline static const std::string QUOTE_KEY = "QUOTE";
55  inline static const std::string ESCAPE_KEY = "ESCAPE";
56  inline static const std::string LINE_DELIMITER_KEY = "LINE_DELIMITER";
57  inline static const std::string ARRAY_DELIMITER_KEY = "ARRAY_DELIMITER";
58  inline static const std::string ARRAY_MARKER_KEY = "ARRAY_MARKER";
59  inline static const std::string LONLAT_KEY = "LONLAT";
60  inline static const std::string GEO_EXPLODE_COLLECTIONS_KEY = "GEO_EXPLODE_COLLECTIONS";
61  inline static const std::string SOURCE_SRID_KEY = "SOURCE_SRID";
62  inline static const std::string TRIM_SPACES_KEY = "TRIM_SPACES";
63 };
64 } // namespace foreign_storage
static const std::string GEO_EXPLODE_COLLECTIONS_KEY
static const std::string TRIM_SPACES_KEY
static const std::string ARRAY_MARKER_KEY
static const std::string SOURCE_SRID_KEY
static const std::string LINE_DELIMITER_KEY
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 override
static const std::string DELIMITER_KEY
import_export::CopyParams validateAndGetCopyParams(const ForeignTable *foreign_table) const override
static const std::string ARRAY_DELIMITER_KEY
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
void validateFiles(const FileReader *file_reader, const ForeignTable *foreign_table) const override
ParseBufferResult parseBuffer(ParseBufferRequest &request, bool convert_data_blocks, bool columns_are_pre_filtered=false, bool skip_dict_encoding=false) const override