OmniSciDB  bf83d84833
 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 namespace foreign_storage {
33  public:
34  // The number of elements in a batch that are read from the Parquet file;
35  // this number is subject to change with performance tuning.
36  // Most filesystems use a default block size of 4096 bytes.
37  const static int batch_reader_num_elements = 4096;
38 
39  LazyParquetChunkLoader(std::shared_ptr<arrow::fs::FileSystem> file_system);
40 
64  std::list<std::unique_ptr<ChunkMetadata>> loadChunk(
65  const std::vector<RowGroupInterval>& row_group_intervals,
66  const int parquet_column_index,
67  std::list<Chunk_NS::Chunk>& chunks,
68  StringDictionary* string_dictionary = nullptr);
69 
78  std::list<RowGroupMetadata> metadataScan(const std::set<std::string>& file_paths,
79  const ForeignTableSchema& schema);
80 
90  static bool isColumnMappingSupported(const ColumnDescriptor* omnisci_column,
91  const parquet::ColumnDescriptor* parquet_column);
92 
93  private:
94  std::shared_ptr<arrow::fs::FileSystem> file_system_;
95 };
96 
97 } // 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)
specifies the content in-memory of a row in the column metadata table
std::shared_ptr< arrow::fs::FileSystem > file_system_
std::list< RowGroupMetadata > metadataScan(const std::set< std::string > &file_paths, const ForeignTableSchema &schema)
Perform a metadata scan for the paths specified.