OmniSciDB  471d68cefb
 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 421 of file ArrowImporter.h.

Member Typedef Documentation

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

Definition at line 422 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 423 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 427 of file ArrowImporter.h.

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

427  {
428  if constexpr (std::is_same<DATA_TYPE, bool>::value) { // NOLINT
429  if (v.size() == 0) {
430  return inline_int_null_value<int8_t>();
431  }
432  try {
433  SQLTypeInfo ti(kBOOLEAN);
434  auto datum = StringToDatum(v, ti);
435  return datum.boolval;
436  } catch (...) {
438  return false;
439  }
440  } else if constexpr (std::is_integral<DATA_TYPE>::value) { // NOLINT
441  if (v.size() == 0) {
443  }
444  try {
445  auto ti = data.cd->columnType;
446  auto datum = StringToDatum(v, ti);
447  return datum.bigintval;
448  } catch (...) {
450  return 0;
451  }
452  } else if constexpr (std::is_floating_point<DATA_TYPE>::value) { // NOLINT
453  return atof(v.data());
454  } else if constexpr (std::is_same<DATA_TYPE, std::string>::value) { // NOLINT
455  return v;
456  }
457  }
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(std::string_view s, SQLTypeInfo &ti)
Definition: Datum.cpp:275
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: