OmniSciDB  6686921089
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
foreign_storage::ParquetDecimalEncoder< V, T, NullType > Class Template Reference

#include <ParquetDecimalEncoder.h>

+ Inheritance diagram for foreign_storage::ParquetDecimalEncoder< V, T, NullType >:
+ Collaboration diagram for foreign_storage::ParquetDecimalEncoder< V, T, NullType >:

Public Member Functions

 ParquetDecimalEncoder (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
 
void validate (const int8_t *parquet_data, const int64_t j, const SQLTypeInfo &column_type) const override
 
- Public Member Functions inherited from foreign_storage::TypedParquetInPlaceEncoder< V, T, NullType >
 TypedParquetInPlaceEncoder (Data_Namespace::AbstractBuffer *buffer, const ColumnDescriptor *column_desciptor, const parquet::ColumnDescriptor *parquet_column_descriptor)
 
 TypedParquetInPlaceEncoder (Data_Namespace::AbstractBuffer *buffer, const size_t omnisci_data_type_byte_size, const size_t parquet_data_type_byte_size)
 
void validate (const int8_t *parquet_data, const int64_t j, const SQLTypeInfo &column_type) const override
 
void validateAndAppendData (const int16_t *def_levels, const int16_t *rep_levels, const int64_t values_read, const int64_t levels_read, int8_t *values, const SQLTypeInfo &column_type, InvalidRowGroupIndices &invalid_indices) override
 
void eraseInvalidIndicesInBuffer (const InvalidRowGroupIndices &invalid_indices) override
 
void appendData (const int16_t *def_levels, const int16_t *rep_levels, const int64_t values_read, const int64_t levels_read, int8_t *values) override
 
void encodeAndCopyContiguous (const int8_t *parquet_data_bytes, int8_t *omnisci_data_bytes, const size_t num_elements) override
 
void setNull (int8_t *omnisci_data_bytes) override
 
void copy (const int8_t *omnisci_data_bytes_source, int8_t *omnisci_data_bytes_destination) override
 
std::shared_ptr< ChunkMetadatagetRowGroupMetadata (const parquet::RowGroupMetaData *group_metadata, const int parquet_column_index, const SQLTypeInfo &column_type) override
 
- Public Member Functions inherited from foreign_storage::ParquetInPlaceEncoder
 ParquetInPlaceEncoder (Data_Namespace::AbstractBuffer *buffer, const size_t omnisci_data_type_byte_size, const size_t parquet_data_type_byte_size)
 
- Public Member Functions inherited from foreign_storage::ParquetScalarEncoder
 ParquetScalarEncoder (Data_Namespace::AbstractBuffer *buffer)
 
- Public Member Functions inherited from foreign_storage::ParquetEncoder
 ParquetEncoder (Data_Namespace::AbstractBuffer *buffer)
 
virtual ~ParquetEncoder ()=default
 

Protected Member Functions

int64_t getDecimal (const int32_t &parquet_data_value) const
 
int64_t getDecimal (const int64_t &parquet_data_value) const
 
int64_t getDecimal (const parquet::FixedLenByteArray &parquet_data_value) const
 
int64_t getDecimal (const parquet::ByteArray &parquet_data_value) const
 
bool encodingIsIdentityForSameTypes () const override
 
- Protected Member Functions inherited from foreign_storage::TypedParquetInPlaceEncoder< V, T, NullType >
std::pair< T, T > getUnencodedStats (std::shared_ptr< parquet::Statistics > stats) const
 

Private Member Functions

int64_t convertDecimalByteArrayToInt (const uint8_t *byte_array, const int byte_array_size) const
 

Private Attributes

const size_t parquet_column_type_length_
 
const DecimalOverflowValidator decimal_overflow_validator_
 

Additional Inherited Members

- Static Protected Member Functions inherited from foreign_storage::ParquetEncoder
static std::shared_ptr
< ChunkMetadata
createMetadata (const SQLTypeInfo &column_type)
 
static void throwNotNullViolation (const std::string &parquet_column_name)
 
static void validateNullCount (const std::string &parquet_column_name, int64_t null_count, const SQLTypeInfo &column_type)
 
- Protected Attributes inherited from foreign_storage::ParquetInPlaceEncoder
const size_t omnisci_data_type_byte_size_
 
const size_t parquet_data_type_byte_size_
 
- Protected Attributes inherited from foreign_storage::ParquetEncoder
Data_Namespace::AbstractBufferbuffer_
 

Detailed Description

template<typename V, typename T, typename NullType = V>
class foreign_storage::ParquetDecimalEncoder< V, T, NullType >

Definition at line 24 of file ParquetDecimalEncoder.h.

Constructor & Destructor Documentation

template<typename V , typename T , typename NullType = V>
foreign_storage::ParquetDecimalEncoder< V, T, NullType >::ParquetDecimalEncoder ( Data_Namespace::AbstractBuffer buffer,
const ColumnDescriptor column_desciptor,
const parquet::ColumnDescriptor *  parquet_column_descriptor 
)
inline

Definition at line 26 of file ParquetDecimalEncoder.h.

29  : TypedParquetInPlaceEncoder<V, T, NullType>(buffer,
30  column_desciptor,
31  parquet_column_descriptor)
32  , parquet_column_type_length_(parquet_column_descriptor->type_length())
33  , decimal_overflow_validator_(column_desciptor->columnType) {}
const DecimalOverflowValidator decimal_overflow_validator_
SQLTypeInfo columnType

Member Function Documentation

template<typename V , typename T , typename NullType = V>
int64_t foreign_storage::ParquetDecimalEncoder< V, T, NullType >::convertDecimalByteArrayToInt ( const uint8_t *  byte_array,
const int  byte_array_size 
) const
inlineprivate

Definition at line 71 of file ParquetDecimalEncoder.h.

References CHECK, and run_benchmark_import::result.

Referenced by foreign_storage::ParquetDecimalEncoder< V, T, NullType >::getDecimal().

72  {
73  auto result = arrow::Decimal128::FromBigEndian(byte_array, byte_array_size);
74  CHECK(result.ok()) << result.status().message();
75  auto& decimal = result.ValueOrDie();
76  return static_cast<int64_t>(decimal);
77  }
#define CHECK(condition)
Definition: Logger.h:209

+ Here is the caller graph for this function:

template<typename V , typename T , typename NullType = V>
void foreign_storage::ParquetDecimalEncoder< V, T, NullType >::encodeAndCopy ( const int8_t *  parquet_data_bytes,
int8_t *  omnisci_data_bytes 
)
inlineoverridevirtual

Implements foreign_storage::ParquetScalarEncoder.

Definition at line 35 of file ParquetDecimalEncoder.h.

References foreign_storage::ParquetDecimalEncoder< V, T, NullType >::getDecimal(), and omnisci.dtypes::T.

36  {
37  const auto& parquet_data_value = reinterpret_cast<const T*>(parquet_data_bytes)[0];
38  auto& omnisci_data_value = reinterpret_cast<V*>(omnisci_data_bytes)[0];
39  omnisci_data_value = getDecimal(parquet_data_value);
40  }
int64_t getDecimal(const int32_t &parquet_data_value) const

+ Here is the call graph for this function:

template<typename V , typename T , typename NullType = V>
bool foreign_storage::ParquetDecimalEncoder< V, T, NullType >::encodingIsIdentityForSameTypes ( ) const
inlineoverrideprotectedvirtual

Reimplemented from foreign_storage::TypedParquetInPlaceEncoder< V, T, NullType >.

Definition at line 68 of file ParquetDecimalEncoder.h.

68 { return true; }
template<typename V , typename T , typename NullType = V>
int64_t foreign_storage::ParquetDecimalEncoder< V, T, NullType >::getDecimal ( const int32_t &  parquet_data_value) const
inlineprotected

Definition at line 51 of file ParquetDecimalEncoder.h.

Referenced by foreign_storage::ParquetDecimalEncoder< V, T, NullType >::encodeAndCopy(), and foreign_storage::ParquetDecimalEncoder< V, T, NullType >::validate().

51  {
52  return parquet_data_value;
53  }

+ Here is the caller graph for this function:

template<typename V , typename T , typename NullType = V>
int64_t foreign_storage::ParquetDecimalEncoder< V, T, NullType >::getDecimal ( const int64_t &  parquet_data_value) const
inlineprotected

Definition at line 55 of file ParquetDecimalEncoder.h.

55  {
56  return parquet_data_value;
57  }
template<typename V , typename T , typename NullType = V>
int64_t foreign_storage::ParquetDecimalEncoder< V, T, NullType >::getDecimal ( const parquet::FixedLenByteArray &  parquet_data_value) const
inlineprotected

Definition at line 59 of file ParquetDecimalEncoder.h.

References foreign_storage::ParquetDecimalEncoder< V, T, NullType >::convertDecimalByteArrayToInt(), and foreign_storage::ParquetDecimalEncoder< V, T, NullType >::parquet_column_type_length_.

59  {
60  return convertDecimalByteArrayToInt(parquet_data_value.ptr,
62  }
int64_t convertDecimalByteArrayToInt(const uint8_t *byte_array, const int byte_array_size) const

+ Here is the call graph for this function:

template<typename V , typename T , typename NullType = V>
int64_t foreign_storage::ParquetDecimalEncoder< V, T, NullType >::getDecimal ( const parquet::ByteArray &  parquet_data_value) const
inlineprotected

Definition at line 64 of file ParquetDecimalEncoder.h.

References foreign_storage::ParquetDecimalEncoder< V, T, NullType >::convertDecimalByteArrayToInt().

64  {
65  return convertDecimalByteArrayToInt(parquet_data_value.ptr, parquet_data_value.len);
66  }
int64_t convertDecimalByteArrayToInt(const uint8_t *byte_array, const int byte_array_size) const

+ Here is the call graph for this function:

template<typename V , typename T , typename NullType = V>
void foreign_storage::ParquetDecimalEncoder< V, T, NullType >::validate ( const int8_t *  parquet_data,
const int64_t  j,
const SQLTypeInfo column_type 
) const
inlineoverridevirtual

Implements foreign_storage::ParquetScalarEncoder.

Definition at line 42 of file ParquetDecimalEncoder.h.

References foreign_storage::ParquetDecimalEncoder< V, T, NullType >::decimal_overflow_validator_, foreign_storage::ParquetDecimalEncoder< V, T, NullType >::getDecimal(), omnisci.dtypes::T, and DecimalOverflowValidator::validate().

44  {
45  const auto& parquet_data_value = reinterpret_cast<const T*>(parquet_data)[j];
46  int64_t omnisci_data_value = getDecimal(parquet_data_value);
47  decimal_overflow_validator_.validate(omnisci_data_value);
48  }
int64_t getDecimal(const int32_t &parquet_data_value) const
const DecimalOverflowValidator decimal_overflow_validator_
void validate(T value) const
Definition: Encoder.h:54

+ Here is the call graph for this function:

Member Data Documentation

template<typename V , typename T , typename NullType = V>
const DecimalOverflowValidator foreign_storage::ParquetDecimalEncoder< V, T, NullType >::decimal_overflow_validator_
private
template<typename V , typename T , typename NullType = V>
const size_t foreign_storage::ParquetDecimalEncoder< V, T, NullType >::parquet_column_type_length_
private

The documentation for this class was generated from the following file: