OmniSciDB  a5dc49c757
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
data_conversion::TypedBaseConvertEncoder< DataType_, MetadataType_ > Class Template Reference

#include <BaseConvertEncoder.h>

+ Inheritance diagram for data_conversion::TypedBaseConvertEncoder< DataType_, MetadataType_ >:
+ Collaboration diagram for data_conversion::TypedBaseConvertEncoder< DataType_, MetadataType_ >:

Public Types

using DataType = DataType_
 
using MetadataType = MetadataType_
 

Public Member Functions

 TypedBaseConvertEncoder (const bool error_tracking_enabled)
 
std::shared_ptr< ChunkMetadatagetMetadata (const Chunk_NS::Chunk &chunk) const override
 
- Public Member Functions inherited from data_conversion::BaseConvertEncoder
virtual ~BaseConvertEncoder ()
 
 BaseConvertEncoder (const bool error_tracking_enabled)
 
void initializeDeleteBuffer (const size_t size_hint)
 
virtual void finalize (const size_t rows_appended)
 
virtual void encodeAndAppendData (const int8_t *data, const size_t num_elements)=0
 

Protected Member Functions

DataType getNull () const
 
void updateMetadataStats (const DataType &typed_value, const bool is_date_in_days=false)
 
- Protected Member Functions inherited from data_conversion::BaseConvertEncoder
virtual void clear ()
 
template<typename DataType >
bool isNull (const DataType &typed_value)
 

Protected Attributes

MetadataType min_
 
MetadataType max_
 
- Protected Attributes inherited from data_conversion::BaseConvertEncoder
std::optional< std::vector
< bool > > 
delete_buffer_
 
const bool error_tracking_enabled_
 
bool has_nulls_
 
size_t num_elements_
 

Detailed Description

template<typename DataType_, typename MetadataType_ = DataType_>
class data_conversion::TypedBaseConvertEncoder< DataType_, MetadataType_ >

Definition at line 96 of file BaseConvertEncoder.h.

Member Typedef Documentation

template<typename DataType_, typename MetadataType_ = DataType_>
using data_conversion::TypedBaseConvertEncoder< DataType_, MetadataType_ >::DataType = DataType_

Definition at line 98 of file BaseConvertEncoder.h.

template<typename DataType_, typename MetadataType_ = DataType_>
using data_conversion::TypedBaseConvertEncoder< DataType_, MetadataType_ >::MetadataType = MetadataType_

Definition at line 99 of file BaseConvertEncoder.h.

Constructor & Destructor Documentation

template<typename DataType_, typename MetadataType_ = DataType_>
data_conversion::TypedBaseConvertEncoder< DataType_, MetadataType_ >::TypedBaseConvertEncoder ( const bool  error_tracking_enabled)
inline

Definition at line 101 of file BaseConvertEncoder.h.

102  : BaseConvertEncoder(error_tracking_enabled) {
103  min_ = std::numeric_limits<MetadataType>::max();
104  max_ = std::numeric_limits<MetadataType>::lowest();
105  }
BaseConvertEncoder(const bool error_tracking_enabled)

Member Function Documentation

template<typename DataType_, typename MetadataType_ = DataType_>
std::shared_ptr<ChunkMetadata> data_conversion::TypedBaseConvertEncoder< DataType_, MetadataType_ >::getMetadata ( const Chunk_NS::Chunk chunk) const
inlineoverridevirtual

Reimplemented from data_conversion::BaseConvertEncoder.

Definition at line 107 of file BaseConvertEncoder.h.

108  {
109  auto metadata = BaseConvertEncoder::getMetadata(chunk);
110  metadata->fillChunkStats(min_, max_, has_nulls_);
111  return metadata;
112  }
virtual std::shared_ptr< ChunkMetadata > getMetadata(const Chunk_NS::Chunk &chunk) const
template<typename DataType_, typename MetadataType_ = DataType_>
DataType data_conversion::TypedBaseConvertEncoder< DataType_, MetadataType_ >::getNull ( ) const
inlineprotected

Definition at line 115 of file BaseConvertEncoder.h.

Referenced by data_conversion::StringViewToScalarEncoder< DataType, MetadataType >::convertAndUpdateMetadata().

115  {
116  if constexpr (std::is_arithmetic<DataType>::value) {
117  auto null = foreign_storage::get_null_value<DataType>();
118  return null;
119  } else if constexpr (std::is_same<DataType, std::string>::value ||
120  std::is_same<DataType, std::string_view>::value) {
121  return std::string{}; // empty_string
122  } else {
123  return nullptr;
124  }
125  }

+ Here is the caller graph for this function:

template<typename DataType_, typename MetadataType_ = DataType_>
void data_conversion::TypedBaseConvertEncoder< DataType_, MetadataType_ >::updateMetadataStats ( const DataType typed_value,
const bool  is_date_in_days = false 
)
inlineprotected

Definition at line 127 of file BaseConvertEncoder.h.

Referenced by data_conversion::StringViewToScalarEncoder< DataType, MetadataType >::convertAndUpdateMetadata(), and data_conversion::StringViewToStringDictEncoder< IdType >::encodeAndAppendData().

128  {
129  if (is_date_in_days) {
130  const MetadataType to_compare =
132  min_ = std::min<MetadataType>(min_, to_compare);
133  max_ = std::max<MetadataType>(max_, to_compare);
134  } else {
135  min_ = std::min<MetadataType>(min_, typed_value);
136  max_ = std::max<MetadataType>(max_, typed_value);
137  }
138  }
int64_t get_epoch_seconds_from_days(const int64_t days)

+ Here is the caller graph for this function:

Member Data Documentation


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