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

#include <ArrowImporter.h>

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

Public Types

using VALUE_TYPE = std::string
 

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

Additional Inherited Members

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

Detailed Description

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

Definition at line 422 of file ArrowImporter.h.

Member Typedef Documentation

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

Definition at line 423 of file ArrowImporter.h.

Constructor & Destructor Documentation

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

Definition at line 424 of file ArrowImporter.h.

Member Function Documentation

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

Definition at line 428 of file ArrowImporter.h.

References anonymous_namespace{ArrowImporter.h}::data_conversion_error(), inline_fixed_encoding_null_val(), kBOOLEAN, and StringToDatum().

428  {
429  if constexpr (std::is_same<DATA_TYPE, bool>::value) { // NOLINT
430  if (v.size() == 0) {
431  return inline_int_null_value<int8_t>();
432  }
433  try {
434  SQLTypeInfo ti(kBOOLEAN);
435  auto datum = StringToDatum(v, ti);
436  return datum.boolval;
437  } catch (...) {
439  return false;
440  }
441  } else if constexpr (std::is_integral<DATA_TYPE>::value) { // NOLINT
442  if (v.size() == 0) {
444  }
445  try {
446  auto ti = data.cd->columnType;
447  auto datum = StringToDatum(v, ti);
448  return datum.bigintval;
449  } catch (...) {
451  return 0;
452  }
453  } else if constexpr (std::is_floating_point<DATA_TYPE>::value) { // NOLINT
454  return atof(v.data());
455  } else if constexpr (std::is_same<DATA_TYPE, std::string>::value) { // NOLINT
456  return v;
457  }
458  }
void data_conversion_error(const VALUE_TYPE v, const ColumnDescriptor *cd, import_export::BadRowsTracker *const bad_rows_tracker)
import_export::BadRowsTracker *const bad_rows_tracker
Datum StringToDatum(const std::string_view s, SQLTypeInfo &ti)
Definition: Datum.cpp:339
int64_t inline_fixed_encoding_null_val(const SQL_TYPE_INFO &ti)
SQLTypeInfo columnType

+ Here is the call graph for this function:


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