OmniSciDB  06b3bd477c
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
anonymous_namespace{JoinHashTable.cpp} Namespace Reference

Classes

class  NeedsOneToManyHash
 

Functions

std::pair< const
Analyzer::ColumnVar *, const
Analyzer::Expr * > 
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{JoinHashTable.cpp}::get_bucketized_hash_entry_info ( SQLTypeInfo const &  context_ti,
ExpressionRange const &  col_range,
bool const  is_bw_eq 
)

Definition at line 218 of file JoinHashTable.cpp.

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

Referenced by JoinHashTable::getHashJoinArgs(), JoinHashTable::getInstance(), JoinHashTable::initOneToManyHashTable(), and JoinHashTable::initOneToOneHashTable().

220  {
221  using EmptyRangeSize = boost::optional<size_t>;
222  auto empty_range_check = [](ExpressionRange const& col_range,
223  bool const is_bw_eq) -> EmptyRangeSize {
224  if (col_range.getIntMin() > col_range.getIntMax()) {
225  CHECK_EQ(col_range.getIntMin(), int64_t(0));
226  CHECK_EQ(col_range.getIntMax(), int64_t(-1));
227  if (is_bw_eq) {
228  return size_t(1);
229  }
230  return size_t(0);
231  }
232  return EmptyRangeSize{};
233  };
234 
235  auto empty_range = empty_range_check(col_range, is_bw_eq);
236  if (empty_range) {
237  return {size_t(*empty_range), 1};
238  }
239 
240  int64_t bucket_normalization =
241  context_ti.get_type() == kDATE ? col_range.getBucket() : 1;
242  CHECK_GT(bucket_normalization, 0);
243  return {size_t(col_range.getIntMax() - col_range.getIntMin() + 1 + (is_bw_eq ? 1 : 0)),
244  bucket_normalization};
245 }
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:54
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<const Analyzer::ColumnVar*, const Analyzer::Expr*> anonymous_namespace{JoinHashTable.cpp}::get_cols ( const Analyzer::BinOper qual_bin_oper,
const Catalog_Namespace::Catalog cat,
const TemporaryTables temporary_tables 
)

Definition at line 209 of file JoinHashTable.cpp.

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

Referenced by JoinHashTable::codegenMatchingSet(), JoinHashTable::codegenSlot(), get_shard_count(), JoinHashTable::getInstance(), JoinHashTable::reify(), JoinHashTable::reifyOneToManyForDevice(), and JoinHashTable::reifyOneToOneForDevice().

212  {
213  const auto lhs = qual_bin_oper->get_left_operand();
214  const auto rhs = qual_bin_oper->get_right_operand();
215  return normalize_column_pair(lhs, rhs, cat, temporary_tables);
216 }
const Expr * get_right_operand() const
Definition: Analyzer.h:444
const Expr * get_left_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)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

Definition at line 247 of file JoinHashTable.cpp.

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

Referenced by JoinHashTable::getHashJoinArgs().

247  {
248  if (col_range.getIntMin() > col_range.getIntMax()) {
249  CHECK_EQ(col_range.getIntMin(), int64_t(0));
250  CHECK_EQ(col_range.getIntMax(), int64_t(-1));
251  return is_bw_eq ? 1 : 0;
252  }
253  return col_range.getIntMax() - col_range.getIntMin() + 1 + (is_bw_eq ? 1 : 0);
254 }
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{JoinHashTable.cpp}::shard_count_less_or_equal_device_count ( const int  inner_table_id,
const Executor executor 
)

Definition at line 282 of file JoinHashTable.cpp.

Referenced by get_shard_count().

283  {
284  const auto inner_table_info = executor->getTableInfo(inner_table_id);
285  std::unordered_set<int> device_holding_fragments;
286  auto cuda_mgr = executor->getCatalog()->getDataMgr().getCudaMgr();
287  const int device_count = cuda_mgr ? cuda_mgr->getDeviceCount() : 1;
288  for (const auto& fragment : inner_table_info.fragments) {
289  if (fragment.shard != -1) {
290  const auto it_ok = device_holding_fragments.emplace(fragment.shard % device_count);
291  if (!it_ok.second) {
292  return false;
293  }
294  }
295  }
296  return true;
297 }

+ Here is the caller graph for this function: