OmniSciDB  95562058bd
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ParquetFixedLengthEncoder.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 "ParquetInPlaceEncoder.h"
20 
21 namespace foreign_storage {
22 template <typename V, typename T>
24  public:
26  const ColumnDescriptor* column_desciptor,
27  const parquet::ColumnDescriptor* parquet_column_descriptor)
28  : TypedParquetInPlaceEncoder<V, T>(buffer,
29  column_desciptor,
30  parquet_column_descriptor) {}
31 
32  void encodeAndCopy(const int8_t* parquet_data_bytes,
33  int8_t* omnisci_data_bytes) override {
34  const auto& parquet_data_value = reinterpret_cast<const T*>(parquet_data_bytes)[0];
35  auto& omnisci_data_value = reinterpret_cast<V*>(omnisci_data_bytes)[0];
36  omnisci_data_value = parquet_data_value;
37  }
38 
39  protected:
40  bool encodingIsIdentityForSameTypes() const override { return true; }
41 };
42 
43 template <typename V, typename T, typename U>
45  public:
48  const ColumnDescriptor* column_desciptor,
49  const parquet::ColumnDescriptor* parquet_column_descriptor)
50  : TypedParquetInPlaceEncoder<V, T>(buffer,
51  column_desciptor,
52  parquet_column_descriptor) {}
53 
54  void encodeAndCopy(const int8_t* parquet_data_bytes,
55  int8_t* omnisci_data_bytes) override {
56  const auto& parquet_data_value = reinterpret_cast<const T*>(parquet_data_bytes)[0];
57  auto& omnisci_data_value = reinterpret_cast<V*>(omnisci_data_bytes)[0];
58  omnisci_data_value = static_cast<U>(parquet_data_value);
59  }
60 };
61 
62 } // namespace foreign_storage
ParquetUnsignedFixedLengthEncoder(Data_Namespace::AbstractBuffer *buffer, const ColumnDescriptor *column_desciptor, const parquet::ColumnDescriptor *parquet_column_descriptor)
ParquetFixedLengthEncoder(Data_Namespace::AbstractBuffer *buffer, const ColumnDescriptor *column_desciptor, const parquet::ColumnDescriptor *parquet_column_descriptor)
void encodeAndCopy(const int8_t *parquet_data_bytes, int8_t *omnisci_data_bytes) override
An AbstractBuffer is a unit of data management for a data manager.
specifies the content in-memory of a row in the column metadata table
void encodeAndCopy(const int8_t *parquet_data_bytes, int8_t *omnisci_data_bytes) override