OmniSciDB  72c90bc290
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
data_conversion::anonymous_namespace{StringViewSource.h} Namespace Reference

Functions

template<typename DataType >
bool is_null (const DataType &typed_value)
 
template<typename T >
std::vector< std::string_view > get_materialized_string_views (const size_t num_elements, const StringDictionary *string_dict, const T *ids)
 
std::vector< std::string_view > get_materialized_string_views (const size_t num_elements, const StringDictionary *string_dict, const int8_t *ids, const SQLTypeInfo &type_info)
 

Function Documentation

template<typename T >
std::vector<std::string_view> data_conversion::anonymous_namespace{StringViewSource.h}::get_materialized_string_views ( const size_t  num_elements,
const StringDictionary string_dict,
const T *  ids 
)

Definition at line 39 of file StringViewSource.h.

References StringDictionary::getStringView(), is_null(), heavydb.dtypes::T, and shared::transform().

Referenced by get_materialized_string_views(), and data_conversion::StringViewSource::getSourceData().

42  {
43  std::vector<std::string_view> materialized_string_views(num_elements);
44  std::transform(ids,
45  ids + num_elements,
46  materialized_string_views.begin(),
47  [&string_dict](const T& id) -> std::string_view {
48  if (is_null(id)) {
49  return std::string_view(nullptr, 0);
50  }
51  return string_dict->getStringView(id);
52  });
53  return materialized_string_views;
54 }
std::string_view getStringView(int32_t string_id) const
CONSTEXPR DEVICE bool is_null(const T &value)
OUTPUT transform(INPUT const &input, FUNC const &func)
Definition: misc.h:320

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

std::vector<std::string_view> data_conversion::anonymous_namespace{StringViewSource.h}::get_materialized_string_views ( const size_t  num_elements,
const StringDictionary string_dict,
const int8_t *  ids,
const SQLTypeInfo type_info 
)

Definition at line 56 of file StringViewSource.h.

References get_materialized_string_views(), SQLTypeInfo::get_size(), and UNREACHABLE.

60  {
61  switch (type_info.get_size()) {
62  case 1:
64  num_elements, string_dict, reinterpret_cast<const uint8_t*>(ids));
65  break;
66  case 2:
68  num_elements, string_dict, reinterpret_cast<const uint16_t*>(ids));
69  break;
70  case 4:
72  num_elements, string_dict, reinterpret_cast<const int32_t*>(ids));
73  break;
74  default:
75  UNREACHABLE();
76  }
77 
78  return {};
79 }
std::vector< std::string_view > get_materialized_string_views(const size_t num_elements, const StringDictionary *string_dict, const T *ids)
HOST DEVICE int get_size() const
Definition: sqltypes.h:403
#define UNREACHABLE()
Definition: Logger.h:338

+ Here is the call graph for this function:

template<typename DataType >
bool data_conversion::anonymous_namespace{StringViewSource.h}::is_null ( const DataType &  typed_value)

Definition at line 23 of file StringViewSource.h.

References UNREACHABLE.

23  {
24  if constexpr (std::is_arithmetic<DataType>::value) {
25  auto null = foreign_storage::get_null_value<DataType>();
26  if (typed_value == null) {
27  return true;
28  } else {
29  return false;
30  }
31  }
32 
33  UNREACHABLE();
34 
35  return false;
36 }
#define UNREACHABLE()
Definition: Logger.h:338