OmniSciDB  1dac507f6e
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
anonymous_namespace{ArrowImporter.h}::ArrowValue< int64_t > Struct Template Reference

#include <ArrowImporter.h>

+ Inheritance diagram for anonymous_namespace{ArrowImporter.h}::ArrowValue< int64_t >:
+ Collaboration diagram for anonymous_namespace{ArrowImporter.h}::ArrowValue< int64_t >:

Public Types

using VALUE_TYPE = int64_t
 

Public Member Functions

 ArrowValue (const DataBufferBase &data, const VALUE_TYPE &v)
 
template<typename DATA_TYPE , typename = enable_if_integral<DATA_TYPE>>
 operator const DATA_TYPE () const
 
template<typename DATA_TYPE , typename = enable_if_floating<DATA_TYPE>>
 operator DATA_TYPE () const
 
 operator const std::string () const
 
- Public Member Functions inherited from anonymous_namespace{ArrowImporter.h}::ArrowValueBase< int64_t >
 ArrowValueBase (const DataBufferBase &data, const int64_t &v)
 
int64_t resolve_time (const int64_t &v, std::enable_if_t< enabled > *=0) const
 
int64_t resolve_time (const int64_t &v, std::enable_if_t<!enabled > *=0) const
 

Additional Inherited Members

- Public Attributes inherited from anonymous_namespace{ArrowImporter.h}::ArrowValueBase< int64_t >
const DataBufferBasedata
 
const int64_t v
 
const int32_t dimension
 

Detailed Description

template<>
struct anonymous_namespace{ArrowImporter.h}::ArrowValue< int64_t >

Definition at line 356 of file ArrowImporter.h.

Member Typedef Documentation

using anonymous_namespace{ArrowImporter.h}::ArrowValue< int64_t >::VALUE_TYPE = int64_t

Definition at line 357 of file ArrowImporter.h.

Constructor & Destructor Documentation

anonymous_namespace{ArrowImporter.h}::ArrowValue< int64_t >::ArrowValue ( const DataBufferBase data,
const VALUE_TYPE v 
)
inline

Definition at line 358 of file ArrowImporter.h.

Member Function Documentation

template<typename DATA_TYPE , typename = enable_if_integral<DATA_TYPE>>
anonymous_namespace{ArrowImporter.h}::ArrowValue< int64_t >::operator const DATA_TYPE ( ) const
inlineexplicit

Definition at line 361 of file ArrowImporter.h.

361  {
362  int64_t v = this->v;
363  if (std::is_same<int64_t, DATA_TYPE>::value) {
364  } else if (std::numeric_limits<DATA_TYPE>::lowest() < v &&
365  v <= std::numeric_limits<DATA_TYPE>::max()) {
366  } else {
367  data_conversion_error<DATA_TYPE>(v, data.cd, data.bad_rows_tracker);
368  }
369  if (data.cd->columnType.is_time()) {
370  v = this->resolve_time(v);
371  }
372  return v;
373  }
bool is_time() const
Definition: sqltypes.h:483
Importer_NS::BadRowsTracker *const bad_rows_tracker
int64_t resolve_time(const int64_t &v, std::enable_if_t< enabled > *=0) const
SQLTypeInfo columnType
anonymous_namespace{ArrowImporter.h}::ArrowValue< int64_t >::operator const std::string ( ) const
inlineexplicit

Definition at line 378 of file ArrowImporter.h.

References anonymous_namespace{ArrowImporter.h}::_precision_scale_lookup, Datum::bigintval, DatumToString(), kDATE, kTIMESTAMP, run_benchmark_import::result, and to_string().

378  {
379  const auto& type_id = data.arrow_type.id();
380  if (type_id == Type::DATE32 || type_id == Type::DATE64) {
381  auto& date_type = static_cast<const DateType&>(data.arrow_type);
382  SQLTypeInfo ti(kDATE);
383  Datum datum{.bigintval = date_type.unit() == DateUnit::MILLI
385  : v};
386  return DatumToString(datum, ti);
387  } else if (type_id == Type::TIME32 || type_id == Type::TIME64 ||
388  type_id == Type::TIMESTAMP) {
389  auto& time_type = static_cast<const TimeType&>(data.arrow_type);
390  const auto result =
391  _precision_scale_lookup.find(std::make_pair(0, time_type.unit()));
392  int64_t divisor{1};
393  if (result != _precision_scale_lookup.end()) {
394  divisor = result->second.second;
395  }
397  Datum datum{.bigintval = v / divisor};
398  auto time_str = DatumToString(datum, ti);
399  if (divisor != 1 && v % divisor) {
400  time_str += "." + std::to_string(v % divisor);
401  }
402  return time_str;
403  }
404  return std::to_string(v);
405  }
std::string DatumToString(Datum d, const SQLTypeInfo &ti)
Definition: Datum.cpp:193
std::string to_string(char const *&&v)
static const std::map< std::pair< int32_t, arrow::TimeUnit::type >, std::pair< SQLOps, int64_t > > _precision_scale_lookup
int64_t bigintval
Definition: sqltypes.h:129
Definition: sqltypes.h:56

+ Here is the call graph for this function:

template<typename DATA_TYPE , typename = enable_if_floating<DATA_TYPE>>
anonymous_namespace{ArrowImporter.h}::ArrowValue< int64_t >::operator DATA_TYPE ( ) const
inlineexplicit

Definition at line 375 of file ArrowImporter.h.

375  {
376  return v;
377  }

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