OmniSciDB  baf940c279
anonymous_namespace{ArrowImporter.h}::ArrowValueBase< VALUE_TYPE > Struct Template Reference

#include <ArrowImporter.h>

+ Inheritance diagram for anonymous_namespace{ArrowImporter.h}::ArrowValueBase< VALUE_TYPE >:
+ Collaboration diagram for anonymous_namespace{ArrowImporter.h}::ArrowValueBase< VALUE_TYPE >:

Public Member Functions

 ArrowValueBase (const DataBufferBase &data, const VALUE_TYPE &v)
 
template<bool enabled = std::is_integral<VALUE_TYPE>::value>
int64_t resolve_time (const VALUE_TYPE &v, std::enable_if_t< enabled > *=0) const
 
template<bool enabled = std::is_integral<VALUE_TYPE>::value>
int64_t resolve_time (const VALUE_TYPE &v, std::enable_if_t<!enabled > *=0) const
 

Public Attributes

const DataBufferBasedata
 
const VALUE_TYPE v
 
const int32_t dimension
 

Detailed Description

template<typename VALUE_TYPE>
struct anonymous_namespace{ArrowImporter.h}::ArrowValueBase< VALUE_TYPE >

Definition at line 227 of file ArrowImporter.h.

Constructor & Destructor Documentation

◆ ArrowValueBase()

template<typename VALUE_TYPE>
anonymous_namespace{ArrowImporter.h}::ArrowValueBase< VALUE_TYPE >::ArrowValueBase ( const DataBufferBase data,
const VALUE_TYPE &  v 
)
inline

Definition at line 231 of file ArrowImporter.h.

Member Function Documentation

◆ resolve_time() [1/2]

template<typename VALUE_TYPE>
template<bool enabled = std::is_integral<VALUE_TYPE>::value>
int64_t anonymous_namespace{ArrowImporter.h}::ArrowValueBase< VALUE_TYPE >::resolve_time ( const VALUE_TYPE &  v,
std::enable_if_t< enabled > *  = 0 
) const
inline

Definition at line 238 of file ArrowImporter.h.

238  {
239  const auto& type_id = data.arrow_type.id();
240  if (type_id == arrow::Type::DATE32 || type_id == arrow::Type::DATE64) {
241  auto& date_type = static_cast<const arrow::DateType&>(data.arrow_type);
242  switch (date_type.unit()) {
243  case arrow::DateUnit::DAY:
244  return v * kSecondsInDay;
245  case arrow::DateUnit::MILLI:
246  return v / kMillisecondsInSecond;
247  }
248  } else if (type_id == arrow::Type::TIME32 || type_id == arrow::Type::TIME64 ||
249  type_id == arrow::Type::TIMESTAMP) {
250  auto& time_type = static_cast<const arrow::TimeType&>(data.arrow_type);
251  const auto result =
252  _precision_scale_lookup.find(std::make_pair(dimension, time_type.unit()));
253  if (result != _precision_scale_lookup.end()) {
254  const auto scale = result->second;
255  return scale.first == kMULTIPLY ? v * scale.second : v / scale.second;
256  } else {
257  return v;
258  }
259  }
260  UNREACHABLE() << data.arrow_type << " is not a valid Arrow time or date type";
261  return 0;
262  }
#define UNREACHABLE()
Definition: Logger.h:241
static const std::map< std::pair< int32_t, arrow::TimeUnit::type >, std::pair< SQLOps, int64_t > > _precision_scale_lookup

◆ resolve_time() [2/2]

template<typename VALUE_TYPE>
template<bool enabled = std::is_integral<VALUE_TYPE>::value>
int64_t anonymous_namespace{ArrowImporter.h}::ArrowValueBase< VALUE_TYPE >::resolve_time ( const VALUE_TYPE &  v,
std::enable_if_t<!enabled > *  = 0 
) const
inline

Definition at line 264 of file ArrowImporter.h.

264  {
265  static_assert(enabled, "unreachable");
266  return 0;
267  }

Member Data Documentation

◆ data

template<typename VALUE_TYPE>
const DataBufferBase& anonymous_namespace{ArrowImporter.h}::ArrowValueBase< VALUE_TYPE >::data

◆ dimension

template<typename VALUE_TYPE>
const int32_t anonymous_namespace{ArrowImporter.h}::ArrowValueBase< VALUE_TYPE >::dimension

Definition at line 230 of file ArrowImporter.h.

◆ v

template<typename VALUE_TYPE>
const VALUE_TYPE anonymous_namespace{ArrowImporter.h}::ArrowValueBase< VALUE_TYPE >::v

Definition at line 229 of file ArrowImporter.h.


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