OmniSciDB  85c2d10cdc
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros 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 49 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().

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

References Analyzer::BinOper::get_left_operand(), Analyzer::BinOper::get_right_operand(), and normalize_column_pair().

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

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

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

Referenced by PerfectJoinHashTable::getHashJoinArgs().

78  {
79  if (col_range.getIntMin() > col_range.getIntMax()) {
80  CHECK_EQ(col_range.getIntMin(), int64_t(0));
81  CHECK_EQ(col_range.getIntMax(), int64_t(-1));
82  return is_bw_eq ? 1 : 0;
83  }
84  return col_range.getIntMax() - col_range.getIntMin() + 1 + (is_bw_eq ? 1 : 0);
85 }
int64_t getIntMin() const
#define CHECK_EQ(x, y)
Definition: Logger.h:205
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 91 of file PerfectJoinHashTable.cpp.

Referenced by get_shard_count().

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

+ Here is the caller graph for this function: