OmniSciDB  85c2d10cdc
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
LazyParquetChunkLoader.h
Go to the documentation of this file.
1 /*
2  * Copyright 2020 OmniSci, 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 
19 #include <arrow/filesystem/filesystem.h>
20 #include <parquet/schema.h>
21 
22 #include "DataMgr/Chunk/Chunk.h"
23 #include "ForeignTableSchema.h"
24 #include "Interval.h"
25 #include "ParquetEncoder.h"
26 #include "ParquetShared.h"
27 
28 extern size_t g_max_import_threads;
29 
30 namespace foreign_storage {
31 
36  public:
37  // The number of elements in a batch that are read from the Parquet file;
38  // this number is subject to change with performance tuning.
39  // Most filesystems use a default block size of 4096 bytes.
40  const static int batch_reader_num_elements = 4096;
41 
42  LazyParquetChunkLoader(std::shared_ptr<arrow::fs::FileSystem> file_system,
43  FileReaderMap* file_reader_cache);
44 
68  std::list<std::unique_ptr<ChunkMetadata>> loadChunk(
69  const std::vector<RowGroupInterval>& row_group_intervals,
70  const int parquet_column_index,
71  std::list<Chunk_NS::Chunk>& chunks,
72  StringDictionary* string_dictionary = nullptr);
73 
82  std::list<RowGroupMetadata> metadataScan(const std::set<std::string>& file_paths,
83  const ForeignTableSchema& schema);
84 
94  static bool isColumnMappingSupported(const ColumnDescriptor* omnisci_column,
95  const parquet::ColumnDescriptor* parquet_column);
96 
97  private:
98  std::shared_ptr<arrow::fs::FileSystem> file_system_;
100 
101  std::list<std::unique_ptr<ChunkMetadata>> appendRowGroups(
102  const std::vector<RowGroupInterval>& row_group_intervals,
103  const int parquet_column_index,
104  const ColumnDescriptor* column_descriptor,
105  std::list<Chunk_NS::Chunk>& chunks,
106  StringDictionary* string_dictionary);
107 };
108 } // namespace foreign_storage
static bool isColumnMappingSupported(const ColumnDescriptor *omnisci_column, const parquet::ColumnDescriptor *parquet_column)
std::list< std::unique_ptr< ChunkMetadata > > loadChunk(const std::vector< RowGroupInterval > &row_group_intervals, const int parquet_column_index, std::list< Chunk_NS::Chunk > &chunks, StringDictionary *string_dictionary=nullptr)
LazyParquetChunkLoader(std::shared_ptr< arrow::fs::FileSystem > file_system, FileReaderMap *file_reader_cache)
std::list< std::unique_ptr< ChunkMetadata > > appendRowGroups(const std::vector< RowGroupInterval > &row_group_intervals, const int parquet_column_index, const ColumnDescriptor *column_descriptor, std::list< Chunk_NS::Chunk > &chunks, StringDictionary *string_dictionary)
specifies the content in-memory of a row in the column metadata table
std::shared_ptr< arrow::fs::FileSystem > file_system_
size_t g_max_import_threads
Definition: Importer.cpp:84
std::list< RowGroupMetadata > metadataScan(const std::set< std::string > &file_paths, const ForeignTableSchema &schema)
Perform a metadata scan for the paths specified.