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

#include <ArrowImporter.h>

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

Public Types

using VALUE_TYPE = arrow::Decimal128
 

Public Member Functions

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

Additional Inherited Members

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

Detailed Description

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

Definition at line 461 of file ArrowImporter.h.

Member Typedef Documentation

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

Definition at line 462 of file ArrowImporter.h.

Constructor & Destructor Documentation

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

Definition at line 463 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().

464  : ArrowValueBase<VALUE_TYPE>(data, v) {
465  // omni decimal has only 64 bits
466  arrow_throw_if(!(v.high_bits() == 0 || v.high_bits() == -1),
468  "Truncation error on Arrow Decimal128 value");
469  }
import_export::BadRowsTracker *const bad_rows_tracker
std::string error_context(const ColumnDescriptor *cd, import_export::BadRowsTracker *const bad_rows_tracker)
Definition: ArrowImporter.h:76
void arrow_throw_if(const bool cond, const std::string &message)
Definition: ArrowImporter.h:41

+ Here is the call graph for this function:

Member Function Documentation

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

Definition at line 472 of file ArrowImporter.h.

References convert_decimal_value_to_scale().

472  {
473  if constexpr (std::is_integral<DATA_TYPE>::value) { // NOLINT
474  int64_t v = static_cast<int64_t>(this->v);
475  if (data.cd->columnType.is_decimal()) {
477  }
479  v = std::llround(v / pow(10, data.arrow_decimal_scale));
480  }
481  if (std::is_same<int64_t, DATA_TYPE>::value) {
482  } else if (std::numeric_limits<DATA_TYPE>::lowest() < v &&
483  v <= std::numeric_limits<DATA_TYPE>::max()) {
484  } else {
485  data_conversion_error<DATA_TYPE>(v, data.cd, data.bad_rows_tracker);
486  }
487  return v;
488  } else if constexpr (std::is_floating_point<DATA_TYPE>::value) { // NOLINT
489  int64_t v = static_cast<int64_t>(this->v);
490  return data.arrow_decimal_scale ? v / pow(10, data.arrow_decimal_scale) : v;
491  } else if constexpr (std::is_same<DATA_TYPE, std::string>::value) { // NOLINT
492  return v.ToString(data.arrow_decimal_scale);
493  }
494  }
import_export::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:473
SQLTypeInfo columnType
bool is_decimal() const
Definition: sqltypes.h:512

+ Here is the call graph for this function:


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