OmniSciDB  6686921089
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PerfectJoinHashTable.h File Reference
+ Include dependency graph for PerfectJoinHashTable.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  PerfectJoinHashTable
 
struct  PerfectJoinHashTable::AlternativeCacheKeyForPerfectHashJoin
 

Functions

bool needs_dictionary_translation (const Analyzer::ColumnVar *inner_col, const Analyzer::Expr *outer_col, const Executor *executor)
 
std::vector
< Fragmenter_Namespace::FragmentInfo
only_shards_for_device (const std::vector< Fragmenter_Namespace::FragmentInfo > &fragments, const int device_id, const int device_count)
 
const InputTableInfoget_inner_query_info (const int inner_table_id, const std::vector< InputTableInfo > &query_infos)
 
size_t get_entries_per_device (const size_t total_entries, const size_t shard_count, const size_t device_count, const Data_Namespace::MemoryLevel memory_level)
 

Function Documentation

size_t get_entries_per_device ( const size_t  total_entries,
const size_t  shard_count,
const size_t  device_count,
const Data_Namespace::MemoryLevel  memory_level 
)

Definition at line 1034 of file PerfectJoinHashTable.cpp.

References CHECK_GT, and Data_Namespace::GPU_LEVEL.

Referenced by OverlapsJoinHashTable::computeHashTableCounts(), RangeJoinHashTable::computeRangeHashTableCounts(), and BaselineJoinHashTable::reifyWithLayout().

1037  {
1038  const auto entries_per_shard =
1039  shard_count ? (total_entries + shard_count - 1) / shard_count : total_entries;
1040  size_t entries_per_device = entries_per_shard;
1041  if (memory_level == Data_Namespace::GPU_LEVEL && shard_count) {
1042  const auto shards_per_device = (shard_count + device_count - 1) / device_count;
1043  CHECK_GT(shards_per_device, 0u);
1044  entries_per_device = entries_per_shard * shards_per_device;
1045  }
1046  return entries_per_device;
1047 }
#define CHECK_GT(x, y)
Definition: Logger.h:221

+ Here is the caller graph for this function:

const InputTableInfo& get_inner_query_info ( const int  inner_table_id,
const std::vector< InputTableInfo > &  query_infos 
)

Definition at line 1020 of file PerfectJoinHashTable.cpp.

References CHECK, and i.

Referenced by PerfectJoinHashTable::getInnerQueryInfo(), RangeJoinHashTable::getInstance(), OverlapsJoinHashTable::getInstance(), RangeJoinHashTable::reifyWithLayout(), OverlapsJoinHashTable::reifyWithLayout(), and BaselineJoinHashTable::reifyWithLayout().

1022  {
1023  std::optional<size_t> ti_idx;
1024  for (size_t i = 0; i < query_infos.size(); ++i) {
1025  if (inner_table_id == query_infos[i].table_id) {
1026  ti_idx = i;
1027  break;
1028  }
1029  }
1030  CHECK(ti_idx);
1031  return query_infos[*ti_idx];
1032 }
#define CHECK(condition)
Definition: Logger.h:209

+ Here is the caller graph for this function:

bool needs_dictionary_translation ( const Analyzer::ColumnVar inner_col,
const Analyzer::Expr outer_col,
const Executor executor 
)

Definition at line 270 of file PerfectJoinHashTable.cpp.

References CHECK, CHECK_EQ, get_column_descriptor_maybe(), Analyzer::ColumnVar::get_column_id(), get_column_type(), Analyzer::ColumnVar::get_comp_param(), and Analyzer::ColumnVar::get_table_id().

Referenced by PerfectJoinHashTable::getEffectiveMemoryLevel(), and BaselineJoinHashTable::getEffectiveMemoryLevel().

272  {
273  const auto catalog = executor->getCatalog();
274  CHECK(catalog);
275  const auto inner_cd = get_column_descriptor_maybe(
276  inner_col->get_column_id(), inner_col->get_table_id(), *catalog);
277  const auto& inner_ti = get_column_type(inner_col->get_column_id(),
278  inner_col->get_table_id(),
279  inner_cd,
280  executor->getTemporaryTables());
281  // Only strings may need dictionary translation.
282  if (!inner_ti.is_string()) {
283  return false;
284  }
285  const auto outer_col = dynamic_cast<const Analyzer::ColumnVar*>(outer_col_expr);
286  CHECK(outer_col);
287  const auto outer_cd = get_column_descriptor_maybe(
288  outer_col->get_column_id(), outer_col->get_table_id(), *catalog);
289  // Don't want to deal with temporary tables for now, require translation.
290  if (!inner_cd || !outer_cd) {
291  return true;
292  }
293  const auto& outer_ti = get_column_type(outer_col->get_column_id(),
294  outer_col->get_table_id(),
295  outer_cd,
296  executor->getTemporaryTables());
297  CHECK_EQ(inner_ti.is_string(), outer_ti.is_string());
298  // If the two columns don't share the dictionary, translation is needed.
299  if (outer_ti.get_comp_param() != inner_ti.get_comp_param()) {
300  return true;
301  }
302  const auto inner_str_dict_proxy =
303  executor->getStringDictionaryProxy(inner_col->get_comp_param(), true);
304  CHECK(inner_str_dict_proxy);
305  const auto outer_str_dict_proxy =
306  executor->getStringDictionaryProxy(inner_col->get_comp_param(), true);
307  CHECK(outer_str_dict_proxy);
308 
309  return *inner_str_dict_proxy != *outer_str_dict_proxy;
310 }
int get_table_id() const
Definition: Analyzer.h:193
#define CHECK_EQ(x, y)
Definition: Logger.h:217
const SQLTypeInfo get_column_type(const int col_id, const int table_id, const ColumnDescriptor *cd, const TemporaryTables *temporary_tables)
Definition: Execute.h:234
const ColumnDescriptor * get_column_descriptor_maybe(const int col_id, const int table_id, const Catalog_Namespace::Catalog &cat)
Definition: Execute.h:218
int get_comp_param() const
Definition: Analyzer.h:197
#define CHECK(condition)
Definition: Logger.h:209
int get_column_id() const
Definition: Analyzer.h:194

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

std::vector<Fragmenter_Namespace::FragmentInfo> only_shards_for_device ( const std::vector< Fragmenter_Namespace::FragmentInfo > &  fragments,
const int  device_id,
const int  device_count 
)

Definition at line 312 of file PerfectJoinHashTable.cpp.

References CHECK_GE.

Referenced by PerfectJoinHashTable::reify(), OverlapsJoinHashTable::reifyImpl(), RangeJoinHashTable::reifyWithLayout(), OverlapsJoinHashTable::reifyWithLayout(), and BaselineJoinHashTable::reifyWithLayout().

315  {
316  std::vector<Fragmenter_Namespace::FragmentInfo> shards_for_device;
317  for (const auto& fragment : fragments) {
318  CHECK_GE(fragment.shard, 0);
319  if (fragment.shard % device_count == device_id) {
320  shards_for_device.push_back(fragment);
321  }
322  }
323  return shards_for_device;
324 }
#define CHECK_GE(x, y)
Definition: Logger.h:222

+ Here is the caller graph for this function: