OmniSciDB  c1a53651b2
 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 49 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().

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  auto const normalized_max = col_range.getIntMax() / bucket_normalization;
75  auto const normalized_min = col_range.getIntMin() / bucket_normalization;
76  return {size_t(normalized_max - normalized_min + 1 + (is_bw_eq ? 1 : 0)),
77  bucket_normalization};
78 }
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:70
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 41 of file PerfectJoinHashTable.cpp.

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

43  {
44  const auto lhs = qual_bin_oper->get_left_operand();
45  const auto rhs = qual_bin_oper->get_right_operand();
46  return HashJoin::normalizeColumnPair(lhs, rhs, temporary_tables);
47 }
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_overlaps_join=false)
Definition: HashJoin.cpp:805
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 80 of file PerfectJoinHashTable.cpp.

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

Referenced by PerfectJoinHashTable::getHashJoinArgs().

80  {
81  if (col_range.getIntMin() > col_range.getIntMax()) {
82  CHECK_EQ(col_range.getIntMin(), int64_t(0));
83  CHECK_EQ(col_range.getIntMax(), int64_t(-1));
84  return is_bw_eq ? 1 : 0;
85  }
86  return col_range.getIntMax() - col_range.getIntMin() + 1 + (is_bw_eq ? 1 : 0);
87 }
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 93 of file PerfectJoinHashTable.cpp.

Referenced by get_shard_count().

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

+ Here is the caller graph for this function: