OmniSciDB  a5dc49c757
 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:291
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 121 of file HashJoinKeyHandlers.h.

References type_info_per_key_.

121  {
122  return type_info_per_key_;
123  }
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  {
118  return join_column_per_key_;
119  }
const JoinColumn * join_column_per_key_
DEVICE size_t GenericKeyHandler::get_key_component_count ( ) const
inline

Definition at line 113 of file HashJoinKeyHandlers.h.

References key_component_count_.

113  {
114  return key_component_count_;
115  }
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  {
110  return key_component_count_;
111  }
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 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_
static constexpr int32_t INVALID_STR_ID
torch::Tensor f(torch::Tensor x, torch::Tensor W_target, torch::Tensor b_target)
const int32_t *const * sd_inner_to_outer_translation_maps_
const int32_t * sd_min_inner_elems_
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 127 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 129 of file HashJoinKeyHandlers.h.

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

const int32_t* GenericKeyHandler::sd_min_inner_elems_

Definition at line 130 of file HashJoinKeyHandlers.h.

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

const bool GenericKeyHandler::should_skip_entries_

Definition at line 126 of file HashJoinKeyHandlers.h.

Referenced by operator()().

const JoinColumnTypeInfo* GenericKeyHandler::type_info_per_key_

Definition at line 128 of file HashJoinKeyHandlers.h.

Referenced by get_join_column_type_infos().


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