OmniSciDB  a5dc49c757
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
anonymous_namespace{PerfectJoinHashTable.cpp} Namespace Reference

Functions

std::pair< InnerOuter,
InnerOuterStringOpInfos
get_cols (const Analyzer::BinOper *qual_bin_oper, const TemporaryTables *temporary_tables)
 
BucketizedHashEntryInfo get_bucketized_hash_entry_info (SQLTypeInfo const &context_ti, ExpressionRange const &col_range, bool const is_bw_eq)
 
size_t get_hash_entry_count (const ExpressionRange &col_range, const bool is_bw_eq)
 
bool shard_count_less_or_equal_device_count (const shared::TableKey &inner_table_key, const Executor *executor)
 

Function Documentation

BucketizedHashEntryInfo anonymous_namespace{PerfectJoinHashTable.cpp}::get_bucketized_hash_entry_info ( SQLTypeInfo const &  context_ti,
ExpressionRange const &  col_range,
bool const  is_bw_eq 
)

Definition at line 52 of file PerfectJoinHashTable.cpp.

References CHECK_EQ, CHECK_GT, SQLTypeInfo::get_type(), ExpressionRange::getBucket(), ExpressionRange::getIntMax(), ExpressionRange::getIntMin(), and kDATE.

Referenced by PerfectJoinHashTable::getInstance(), PerfectJoinHashTable::isOneToOneHashPossible(), and PerfectJoinHashTable::reify().

54  {
55  using EmptyRangeSize = std::optional<size_t>;
56  auto empty_range_check = [](ExpressionRange const& col_range,
57  bool const is_bw_eq) -> EmptyRangeSize {
58  if (col_range.getIntMin() > col_range.getIntMax()) {
59  CHECK_EQ(col_range.getIntMin(), int64_t(0));
60  CHECK_EQ(col_range.getIntMax(), int64_t(-1));
61  if (is_bw_eq) {
62  return size_t(1);
63  }
64  return size_t(0);
65  }
66  return EmptyRangeSize{};
67  };
68 
69  auto empty_range = empty_range_check(col_range, is_bw_eq);
70  if (empty_range) {
71  return {size_t(*empty_range), 1};
72  }
73 
74  int64_t bucket_normalization =
75  context_ti.get_type() == kDATE ? col_range.getBucket() : 1;
76  CHECK_GT(bucket_normalization, 0);
77  auto const normalized_max = col_range.getIntMax() / bucket_normalization;
78  auto const normalized_min = col_range.getIntMin() / bucket_normalization;
79  return {size_t(normalized_max - normalized_min + 1 + (is_bw_eq ? 1 : 0)),
80  bucket_normalization};
81 }
int64_t getIntMin() const
#define CHECK_EQ(x, y)
Definition: Logger.h:301
#define CHECK_GT(x, y)
Definition: Logger.h:305
Definition: sqltypes.h:80
int64_t getIntMax() const
int64_t getBucket() const

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

std::pair<InnerOuter, InnerOuterStringOpInfos> anonymous_namespace{PerfectJoinHashTable.cpp}::get_cols ( const Analyzer::BinOper qual_bin_oper,
const TemporaryTables temporary_tables 
)

Definition at line 44 of file PerfectJoinHashTable.cpp.

References Analyzer::BinOper::get_left_operand(), Analyzer::BinOper::get_right_operand(), and HashJoin::normalizeColumnPair().

46  {
47  const auto lhs = qual_bin_oper->get_left_operand();
48  const auto rhs = qual_bin_oper->get_right_operand();
49  return HashJoin::normalizeColumnPair(lhs, rhs, temporary_tables);
50 }
const Expr * get_right_operand() const
Definition: Analyzer.h:456
static std::pair< InnerOuter, InnerOuterStringOpInfos > normalizeColumnPair(const Analyzer::Expr *lhs, const Analyzer::Expr *rhs, const TemporaryTables *temporary_tables, const bool is_bbox_intersect=false)
Definition: HashJoin.cpp:822
const Expr * get_left_operand() const
Definition: Analyzer.h:455

+ Here is the call graph for this function:

size_t anonymous_namespace{PerfectJoinHashTable.cpp}::get_hash_entry_count ( const ExpressionRange col_range,
const bool  is_bw_eq 
)

Definition at line 83 of file PerfectJoinHashTable.cpp.

References CHECK_EQ, ExpressionRange::getIntMax(), and ExpressionRange::getIntMin().

Referenced by PerfectJoinHashTable::getHashJoinArgs().

83  {
84  if (col_range.getIntMin() > col_range.getIntMax()) {
85  CHECK_EQ(col_range.getIntMin(), int64_t(0));
86  CHECK_EQ(col_range.getIntMax(), int64_t(-1));
87  return is_bw_eq ? 1 : 0;
88  }
89  return col_range.getIntMax() - col_range.getIntMin() + 1 + (is_bw_eq ? 1 : 0);
90 }
int64_t getIntMin() const
#define CHECK_EQ(x, y)
Definition: Logger.h:301
int64_t getIntMax() const

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool anonymous_namespace{PerfectJoinHashTable.cpp}::shard_count_less_or_equal_device_count ( const shared::TableKey inner_table_key,
const Executor executor 
)

Definition at line 96 of file PerfectJoinHashTable.cpp.

Referenced by get_shard_count().

97  {
98  const auto inner_table_info = executor->getTableInfo(inner_table_key);
99  std::unordered_set<int> device_holding_fragments;
100  auto cuda_mgr = executor->getDataMgr()->getCudaMgr();
101  const int device_count = cuda_mgr ? cuda_mgr->getDeviceCount() : 1;
102  for (const auto& fragment : inner_table_info.fragments) {
103  if (fragment.shard != -1) {
104  const auto it_ok = device_holding_fragments.emplace(fragment.shard % device_count);
105  if (!it_ok.second) {
106  return false;
107  }
108  }
109  }
110  return true;
111 }

+ Here is the caller graph for this function: