OmniSciDB  eb3a3d0a03
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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 *constsd_inner_proxy_per_key_
 
const void *constsd_outer_proxy_per_key_
 

Detailed Description

Definition at line 39 of file HashJoinKeyHandlers.h.

Constructor & Destructor Documentation

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 40 of file HashJoinKeyHandlers.h.

References CHECK, sd_inner_proxy_per_key_, and sd_outer_proxy_per_key_.

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

Member Function Documentation

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

Definition at line 119 of file HashJoinKeyHandlers.h.

References type_info_per_key_.

119  {
120  return type_info_per_key_;
121  }
const JoinColumnTypeInfo * type_info_per_key_
DEVICE const JoinColumn* GenericKeyHandler::get_join_columns ( ) const
inline

Definition at line 117 of file HashJoinKeyHandlers.h.

References join_column_per_key_.

117 { return join_column_per_key_; }
const JoinColumn * join_column_per_key_
DEVICE size_t GenericKeyHandler::get_key_component_count ( ) const
inline

Definition at line 115 of file HashJoinKeyHandlers.h.

References key_component_count_.

115 { return key_component_count_; }
const size_t key_component_count_
DEVICE size_t GenericKeyHandler::get_number_of_columns ( ) 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_
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 68 of file HashJoinKeyHandlers.h.

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

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

+ Here is the call graph for this function:

Member Data Documentation

const JoinColumn* GenericKeyHandler::join_column_per_key_

Definition at line 125 of file HashJoinKeyHandlers.h.

Referenced by get_join_columns().

const size_t GenericKeyHandler::key_component_count_
const void* const* GenericKeyHandler::sd_inner_proxy_per_key_

Definition at line 127 of file HashJoinKeyHandlers.h.

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

const void* const* GenericKeyHandler::sd_outer_proxy_per_key_

Definition at line 128 of file HashJoinKeyHandlers.h.

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

const bool GenericKeyHandler::should_skip_entries_

Definition at line 124 of file HashJoinKeyHandlers.h.

Referenced by operator()().

const JoinColumnTypeInfo* GenericKeyHandler::type_info_per_key_

Definition at line 126 of file HashJoinKeyHandlers.h.

Referenced by get_join_column_type_infos().


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