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

Functions

InnerOuter get_cols (const Analyzer::BinOper *qual_bin_oper, const Catalog_Namespace::Catalog &cat, const TemporaryTables *temporary_tables)
 
HashEntryInfo 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 int inner_table_id, const Executor *executor)
 

Function Documentation

HashEntryInfo 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 50 of file PerfectJoinHashTable.cpp.

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

Referenced by PerfectJoinHashTable::getHashJoinArgs(), PerfectJoinHashTable::getInstance(), and PerfectJoinHashTable::initHashTableForDevice().

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

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

InnerOuter anonymous_namespace{PerfectJoinHashTable.cpp}::get_cols ( const Analyzer::BinOper qual_bin_oper,
const Catalog_Namespace::Catalog cat,
const TemporaryTables temporary_tables 
)

Definition at line 42 of file PerfectJoinHashTable.cpp.

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

44  {
45  const auto lhs = qual_bin_oper->get_left_operand();
46  const auto rhs = qual_bin_oper->get_right_operand();
47  return HashJoin::normalizeColumnPair(lhs, rhs, cat, temporary_tables);
48 }
const Expr * get_right_operand() const
Definition: Analyzer.h:442
static InnerOuter normalizeColumnPair(const Analyzer::Expr *lhs, const Analyzer::Expr *rhs, const Catalog_Namespace::Catalog &cat, const TemporaryTables *temporary_tables, const bool is_overlaps_join=false)
Definition: HashJoin.cpp:603
const Expr * get_left_operand() const
Definition: Analyzer.h:441

+ 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 79 of file PerfectJoinHashTable.cpp.

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

Referenced by PerfectJoinHashTable::getHashJoinArgs().

79  {
80  if (col_range.getIntMin() > col_range.getIntMax()) {
81  CHECK_EQ(col_range.getIntMin(), int64_t(0));
82  CHECK_EQ(col_range.getIntMax(), int64_t(-1));
83  return is_bw_eq ? 1 : 0;
84  }
85  return col_range.getIntMax() - col_range.getIntMin() + 1 + (is_bw_eq ? 1 : 0);
86 }
int64_t getIntMin() const
#define CHECK_EQ(x, y)
Definition: Logger.h:217
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 int  inner_table_id,
const Executor executor 
)

Definition at line 92 of file PerfectJoinHashTable.cpp.

Referenced by get_shard_count().

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

+ Here is the caller graph for this function: