OmniSciDB  ca0c39ec8f
 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 int32_t *const *sd_inner_to_outer_translation_maps, const int32_t *sd_min_inner_elems)
 
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 int32_t *const * sd_inner_to_outer_translation_maps_
 
const int32_t * sd_min_inner_elems_
 

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 int32_t *const *  sd_inner_to_outer_translation_maps,
const int32_t *  sd_min_inner_elems 
)
inline

Definition at line 40 of file HashJoinKeyHandlers.h.

References CHECK, sd_inner_to_outer_translation_maps_, and sd_min_inner_elems_.

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_to_outer_translation_maps) {
56  CHECK(sd_min_inner_elems);
57  sd_inner_to_outer_translation_maps_ = sd_inner_to_outer_translation_maps;
58  sd_min_inner_elems_ = sd_min_inner_elems;
59  } else
60 #endif
61  {
63  sd_min_inner_elems_ = nullptr;
64  }
65  }
const JoinColumn * join_column_per_key_
const size_t key_component_count_
const JoinColumnTypeInfo * type_info_per_key_
const int32_t *const * sd_inner_to_outer_translation_maps_
#define CHECK(condition)
Definition: Logger.h:222
const int32_t * sd_min_inner_elems_
const bool should_skip_entries_

Member Function Documentation

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

Definition at line 115 of file HashJoinKeyHandlers.h.

References type_info_per_key_.

115  {
116  return type_info_per_key_;
117  }
const JoinColumnTypeInfo * type_info_per_key_
DEVICE const JoinColumn* GenericKeyHandler::get_join_columns ( ) const
inline

Definition at line 113 of file HashJoinKeyHandlers.h.

References join_column_per_key_.

113 { return join_column_per_key_; }
const JoinColumn * join_column_per_key_
DEVICE size_t GenericKeyHandler::get_key_component_count ( ) 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_
DEVICE size_t GenericKeyHandler::get_number_of_columns ( ) const
inline

Definition at line 109 of file HashJoinKeyHandlers.h.

References key_component_count_.

109 { 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 anonymous_namespace{Utm.h}::f, StringDictionary::INVALID_STR_ID, key_component_count_, sd_inner_to_outer_translation_maps_, sd_min_inner_elems_, 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  // Translation map pts will already be set to nullptr if invalid
84  const auto sd_inner_to_outer_translation_map =
85  sd_inner_to_outer_translation_maps_[key_component_index];
86  const auto sd_min_inner_elem = sd_min_inner_elems_[key_component_index];
87  if (sd_inner_to_outer_translation_map &&
88  elem != join_column_iterator.type_info->null_val) {
89  const auto outer_id =
90  sd_inner_to_outer_translation_map[elem - sd_min_inner_elem];
91  if (outer_id == StringDictionary::INVALID_STR_ID) {
92  skip_entry = true;
93  break;
94  }
95  elem = outer_id;
96  }
97  }
98 #endif
99  key_scratch_buff[key_component_index] = elem;
100  }
101 
102  if (!skip_entry) {
103  return f(join_column_iterators[0].index, key_scratch_buff, key_component_count_);
104  }
105 
106  return 0;
107  }
const size_t key_component_count_
constexpr double f
Definition: Utm.h:31
static constexpr int32_t INVALID_STR_ID
const int32_t *const * sd_inner_to_outer_translation_maps_
const int32_t * sd_min_inner_elems_
const bool should_skip_entries_

Member Data Documentation

const JoinColumn* GenericKeyHandler::join_column_per_key_

Definition at line 121 of file HashJoinKeyHandlers.h.

Referenced by get_join_columns().

const size_t GenericKeyHandler::key_component_count_
const int32_t* const* GenericKeyHandler::sd_inner_to_outer_translation_maps_

Definition at line 123 of file HashJoinKeyHandlers.h.

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

const int32_t* GenericKeyHandler::sd_min_inner_elems_

Definition at line 124 of file HashJoinKeyHandlers.h.

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

const bool GenericKeyHandler::should_skip_entries_

Definition at line 120 of file HashJoinKeyHandlers.h.

Referenced by operator()().

const JoinColumnTypeInfo* GenericKeyHandler::type_info_per_key_

Definition at line 122 of file HashJoinKeyHandlers.h.

Referenced by get_join_column_type_infos().


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