OmniSciDB  04ee39c94c
GenericKeyHandler Struct Reference

#include <HashJoinKeyHandlers.h>

+ Collaboration diagram for GenericKeyHandler:

Public Member Functions

 GenericKeyHandler (const size_t key_component_count, const bool should_skip_entries, const JoinColumn *join_column_per_key, const JoinColumnTypeInfo *type_info_per_key, const void *const *sd_inner_proxy_per_key, const void *const *sd_outer_proxy_per_key)
 
template<typename T , typename KEY_BUFF_HANDLER >
DEVICE int operator() (const size_t i, T *key_scratch_buff, KEY_BUFF_HANDLER f) const
 

Public Attributes

const size_t key_component_count_
 
const bool should_skip_entries_
 
const JoinColumnjoin_column_per_key_
 
const JoinColumnTypeInfotype_info_per_key_
 
const void *const * sd_inner_proxy_per_key_
 
const void *const * sd_outer_proxy_per_key_
 

Detailed Description

Definition at line 63 of file HashJoinKeyHandlers.h.

Constructor & Destructor Documentation

◆ GenericKeyHandler()

GenericKeyHandler::GenericKeyHandler ( const size_t  key_component_count,
const bool  should_skip_entries,
const JoinColumn join_column_per_key,
const JoinColumnTypeInfo type_info_per_key,
const void *const *  sd_inner_proxy_per_key,
const void *const *  sd_outer_proxy_per_key 
)
inline

Definition at line 64 of file HashJoinKeyHandlers.h.

References CHECK, sd_inner_proxy_per_key_, and sd_outer_proxy_per_key_.

74  : key_component_count_(key_component_count)
75  , should_skip_entries_(should_skip_entries)
76  , join_column_per_key_(join_column_per_key)
77  , type_info_per_key_(type_info_per_key) {
78 #ifndef __CUDACC__
79  if (sd_inner_proxy_per_key) {
80  CHECK(sd_outer_proxy_per_key);
81  sd_inner_proxy_per_key_ = sd_inner_proxy_per_key;
82  sd_outer_proxy_per_key_ = sd_outer_proxy_per_key;
83  } else
84 #endif
85  {
86  sd_inner_proxy_per_key_ = nullptr;
87  sd_outer_proxy_per_key_ = nullptr;
88  }
89  }
const JoinColumn * join_column_per_key_
const size_t key_component_count_
const void *const * sd_inner_proxy_per_key_
const void *const * sd_outer_proxy_per_key_
const JoinColumnTypeInfo * type_info_per_key_
#define CHECK(condition)
Definition: Logger.h:187
const bool should_skip_entries_

Member Function Documentation

◆ operator()()

template<typename T , typename KEY_BUFF_HANDLER >
DEVICE int GenericKeyHandler::operator() ( const size_t  i,
T *  key_scratch_buff,
KEY_BUFF_HANDLER  f 
) const
inline

Definition at line 92 of file HashJoinKeyHandlers.h.

References CHECK, get_join_column_element_value(), StringDictionaryProxy::getString(), StringDictionary::INVALID_STR_ID, join_column_per_key_, key_component_count_, sd_inner_proxy_per_key_, sd_outer_proxy_per_key_, should_skip_entries_, and type_info_per_key_.

92  {
93  bool skip_entry = false;
94  for (size_t key_component_index = 0; key_component_index < key_component_count_;
95  ++key_component_index) {
96  const auto& join_column = join_column_per_key_[key_component_index];
97  const auto& type_info = type_info_per_key_[key_component_index];
98  int64_t elem = get_join_column_element_value(type_info, join_column, i);
99  if (should_skip_entries_ && elem == type_info.null_val && !type_info.uses_bw_eq) {
100  skip_entry = true;
101  break;
102  }
103 #ifndef __CUDACC__
104  const auto sd_inner_proxy = sd_inner_proxy_per_key_
105  ? sd_inner_proxy_per_key_[key_component_index]
106  : nullptr;
107  const auto sd_outer_proxy = sd_outer_proxy_per_key_
108  ? sd_outer_proxy_per_key_[key_component_index]
109  : nullptr;
110  if (sd_inner_proxy && elem != type_info.null_val) {
111  CHECK(sd_outer_proxy);
112  const auto sd_inner_dict_proxy =
113  static_cast<const StringDictionaryProxy*>(sd_inner_proxy);
114  const auto sd_outer_dict_proxy =
115  static_cast<const StringDictionaryProxy*>(sd_outer_proxy);
116  const auto elem_str = sd_inner_dict_proxy->getString(elem);
117  const auto outer_id = sd_outer_dict_proxy->getIdOfString(elem_str);
118  if (outer_id == StringDictionary::INVALID_STR_ID) {
119  skip_entry = true;
120  break;
121  }
122  elem = outer_id;
123  }
124 #endif
125  key_scratch_buff[key_component_index] = elem;
126  }
127 
128  if (!skip_entry) {
129  return f(i, key_scratch_buff, key_component_count_);
130  }
131 
132  return 0;
133  }
const JoinColumn * join_column_per_key_
const size_t key_component_count_
const void *const * sd_inner_proxy_per_key_
const void *const * sd_outer_proxy_per_key_
static constexpr int32_t INVALID_STR_ID
std::string getString(int32_t string_id) const
const JoinColumnTypeInfo * type_info_per_key_
#define CHECK(condition)
Definition: Logger.h:187
DEVICE int64_t get_join_column_element_value(const JoinColumnTypeInfo &type_info, const JoinColumn &join_column, const size_t i)
const bool should_skip_entries_
+ Here is the call graph for this function:

Member Data Documentation

◆ join_column_per_key_

const JoinColumn* GenericKeyHandler::join_column_per_key_

Definition at line 137 of file HashJoinKeyHandlers.h.

Referenced by operator()().

◆ key_component_count_

const size_t GenericKeyHandler::key_component_count_

Definition at line 135 of file HashJoinKeyHandlers.h.

Referenced by operator()().

◆ sd_inner_proxy_per_key_

const void* const* GenericKeyHandler::sd_inner_proxy_per_key_

Definition at line 139 of file HashJoinKeyHandlers.h.

Referenced by GenericKeyHandler(), and operator()().

◆ sd_outer_proxy_per_key_

const void* const* GenericKeyHandler::sd_outer_proxy_per_key_

Definition at line 140 of file HashJoinKeyHandlers.h.

Referenced by GenericKeyHandler(), and operator()().

◆ should_skip_entries_

const bool GenericKeyHandler::should_skip_entries_

Definition at line 136 of file HashJoinKeyHandlers.h.

Referenced by operator()().

◆ type_info_per_key_

const JoinColumnTypeInfo* GenericKeyHandler::type_info_per_key_

Definition at line 138 of file HashJoinKeyHandlers.h.

Referenced by operator()().


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