OmniSciDB  ab4938a6a3
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() (JoinColumnIterator *join_column_iterators, T *key_scratch_buff, KEY_BUFF_HANDLER f) const
 
DEVICE size_t get_number_of_columns () const
 
DEVICE size_t get_key_component_count () const
 
DEVICE const JoinColumnget_join_columns () const
 
DEVICE const JoinColumnTypeInfoget_join_column_type_infos () 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 37 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 38 of file HashJoinKeyHandlers.h.

References CHECK, sd_inner_proxy_per_key_, and sd_outer_proxy_per_key_.

48  : key_component_count_(key_component_count)
49  , should_skip_entries_(should_skip_entries)
50  , join_column_per_key_(join_column_per_key)
51  , type_info_per_key_(type_info_per_key) {
52 #ifndef __CUDACC__
53  if (sd_inner_proxy_per_key) {
54  CHECK(sd_outer_proxy_per_key);
55  sd_inner_proxy_per_key_ = sd_inner_proxy_per_key;
56  sd_outer_proxy_per_key_ = sd_outer_proxy_per_key;
57  } else
58 #endif
59  {
60  sd_inner_proxy_per_key_ = nullptr;
61  sd_outer_proxy_per_key_ = nullptr;
62  }
63  }
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:197
const bool should_skip_entries_

Member Function Documentation

◆ get_join_column_type_infos()

DEVICE const JoinColumnTypeInfo* GenericKeyHandler::get_join_column_type_infos ( ) const
inline

Definition at line 117 of file HashJoinKeyHandlers.h.

References type_info_per_key_.

117  {
118  return type_info_per_key_;
119  }
const JoinColumnTypeInfo * type_info_per_key_

◆ get_join_columns()

DEVICE const JoinColumn* GenericKeyHandler::get_join_columns ( ) const
inline

Definition at line 115 of file HashJoinKeyHandlers.h.

References join_column_per_key_.

115 { return join_column_per_key_; }
const JoinColumn * join_column_per_key_

◆ get_key_component_count()

DEVICE size_t GenericKeyHandler::get_key_component_count ( ) const
inline

Definition at line 113 of file HashJoinKeyHandlers.h.

References key_component_count_.

113 { return key_component_count_; }
const size_t key_component_count_

◆ get_number_of_columns()

DEVICE size_t GenericKeyHandler::get_number_of_columns ( ) const
inline

Definition at line 111 of file HashJoinKeyHandlers.h.

References key_component_count_.

111 { return key_component_count_; }
const size_t key_component_count_

◆ operator()()

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

Definition at line 66 of file HashJoinKeyHandlers.h.

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

68  {
69  bool skip_entry = false;
70  for (size_t key_component_index = 0; key_component_index < key_component_count_;
71  ++key_component_index) {
72  const auto& join_column_iterator = join_column_iterators[key_component_index];
73  int64_t elem = (*join_column_iterator).element;
74  if (should_skip_entries_ && elem == join_column_iterator.type_info->null_val &&
75  !join_column_iterator.type_info->uses_bw_eq) {
76  skip_entry = true;
77  break;
78  }
79 #ifndef __CUDACC__
80  const auto sd_inner_proxy = sd_inner_proxy_per_key_
81  ? sd_inner_proxy_per_key_[key_component_index]
82  : nullptr;
83  const auto sd_outer_proxy = sd_outer_proxy_per_key_
84  ? sd_outer_proxy_per_key_[key_component_index]
85  : nullptr;
86  if (sd_inner_proxy && elem != join_column_iterator.type_info->null_val) {
87  CHECK(sd_outer_proxy);
88  const auto sd_inner_dict_proxy =
89  static_cast<const StringDictionaryProxy*>(sd_inner_proxy);
90  const auto sd_outer_dict_proxy =
91  static_cast<const StringDictionaryProxy*>(sd_outer_proxy);
92  const auto elem_str = sd_inner_dict_proxy->getString(elem);
93  const auto outer_id = sd_outer_dict_proxy->getIdOfString(elem_str);
94  if (outer_id == StringDictionary::INVALID_STR_ID) {
95  skip_entry = true;
96  break;
97  }
98  elem = outer_id;
99  }
100 #endif
101  key_scratch_buff[key_component_index] = elem;
102  }
103 
104  if (!skip_entry) {
105  return f(join_column_iterators[0].index, key_scratch_buff, key_component_count_);
106  }
107 
108  return 0;
109  }
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
#define CHECK(condition)
Definition: Logger.h:197
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 123 of file HashJoinKeyHandlers.h.

Referenced by get_join_columns().

◆ key_component_count_

const size_t GenericKeyHandler::key_component_count_

◆ sd_inner_proxy_per_key_

const void* const* GenericKeyHandler::sd_inner_proxy_per_key_

Definition at line 125 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 126 of file HashJoinKeyHandlers.h.

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

◆ should_skip_entries_

const bool GenericKeyHandler::should_skip_entries_

Definition at line 122 of file HashJoinKeyHandlers.h.

Referenced by operator()().

◆ type_info_per_key_

const JoinColumnTypeInfo* GenericKeyHandler::type_info_per_key_

Definition at line 124 of file HashJoinKeyHandlers.h.

Referenced by get_join_column_type_infos().


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