OmniSciDB  a5dc49c757
 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 462 of file ArrowImporter.h.

Member Typedef Documentation

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

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

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

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

References convert_decimal_value_to_scale().

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

+ Here is the call graph for this function:


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