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

#include <ArrowImporter.h>

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

Public Types

using VALUE_TYPE = Decimal128
 

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< Decimal128 >
 ArrowValueBase (const DataBufferBase &data, const Decimal128 &v)
 
int64_t resolve_time (const Decimal128 &v, std::enable_if_t< enabled > *=0) const
 
int64_t resolve_time (const Decimal128 &v, std::enable_if_t<!enabled > *=0) const
 

Additional Inherited Members

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

Detailed Description

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

Definition at line 448 of file ArrowImporter.h.

Member Typedef Documentation

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

Definition at line 449 of file ArrowImporter.h.

Constructor & Destructor Documentation

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

Definition at line 450 of file ArrowImporter.h.

References arrow_throw_if(), anonymous_namespace{ArrowImporter.h}::DataBufferBase::bad_rows_tracker, anonymous_namespace{ArrowImporter.h}::DataBufferBase::cd, and anonymous_namespace{ArrowImporter.h}::error_context().

451  : ArrowValueBase<VALUE_TYPE>(data, v) {
452  // omni decimal has only 64 bits
453  arrow_throw_if(!(v.high_bits() == 0 || v.high_bits() == -1),
455  "Truncation error on Arrow Decimal128 value");
456  }
std::string error_context(const ColumnDescriptor *cd, Importer_NS::BadRowsTracker *const bad_rows_tracker)
Definition: ArrowImporter.h:75
Importer_NS::BadRowsTracker *const bad_rows_tracker
void arrow_throw_if(const bool cond, const std::string &message)
Definition: ArrowImporter.h:40

+ Here is the call graph for this function:

Member Function Documentation

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

Definition at line 458 of file ArrowImporter.h.

References convert_decimal_value_to_scale().

458  {
459  int64_t v = static_cast<int64_t>(this->v);
460  if (data.cd->columnType.is_decimal()) {
462  }
464  v = std::llround(v / pow(10, data.arrow_decimal_scale));
465  }
466  if (std::is_same<int64_t, DATA_TYPE>::value) {
467  } else if (std::numeric_limits<DATA_TYPE>::lowest() < v &&
468  v <= std::numeric_limits<DATA_TYPE>::max()) {
469  } else {
470  data_conversion_error<DATA_TYPE>(v, data.cd, data.bad_rows_tracker);
471  }
472  return v;
473  }
Importer_NS::BadRowsTracker *const bad_rows_tracker
int64_t convert_decimal_value_to_scale(const int64_t decimal_value, const SQLTypeInfo &type_info, const SQLTypeInfo &new_type_info)
Definition: Datum.cpp:284
SQLTypeInfo columnType
bool is_decimal() const
Definition: sqltypes.h:480

+ Here is the call graph for this function:

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

Definition at line 475 of file ArrowImporter.h.

475  {
476  int64_t v = static_cast<int64_t>(this->v);
477  return data.arrow_decimal_scale ? v / pow(10, data.arrow_decimal_scale) : v;
478  }

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