OmniSciDB  72c90bc290
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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 228 of file ArrowImporter.h.

Constructor & Destructor Documentation

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

Definition at line 232 of file ArrowImporter.h.

Member Function Documentation

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 239 of file ArrowImporter.h.

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

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

Member Data Documentation

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

Definition at line 231 of file ArrowImporter.h.

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

Definition at line 230 of file ArrowImporter.h.


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