OmniSciDB  c07336695a
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 224 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 228 of file ArrowImporter.h.

229  : data(data)
230  , v(v)
231  , dimension(data.cd->columnType.is_high_precision_timestamp()
233  : 0) {}
HOST DEVICE int get_dimension() const
Definition: sqltypes.h:321
SQLTypeInfo columnType

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

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

261  {
262  static_assert(enabled, "unreachable");
263  return 0;
264  }

Member Data Documentation

◆ data

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

Definition at line 225 of file ArrowImporter.h.

◆ dimension

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

Definition at line 227 of file ArrowImporter.h.

◆ v

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

Definition at line 226 of file ArrowImporter.h.


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