OmniSciDB  a5dc49c757
 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 InnerOuter &inner_outer_col_pair, const InnerOuterStringOpInfos &inner_outer_string_op_infos, const Executor *executor)
 
Data_Namespace::MemoryLevel get_effective_memory_level (const Data_Namespace::MemoryLevel memory_level, const bool needs_dict_translation)
 
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 shared::TableKey &inner_table_key, 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

Data_Namespace::MemoryLevel get_effective_memory_level ( const Data_Namespace::MemoryLevel  memory_level,
const bool  needs_dict_translation 
)
inline

Definition at line 314 of file PerfectJoinHashTable.h.

References Data_Namespace::CPU_LEVEL.

Referenced by PerfectJoinHashTable::fetchColumnsForDevice(), BaselineJoinHashTable::fetchColumnsForDevice(), PerfectJoinHashTable::reifyForDevice(), and BaselineJoinHashTable::reifyForDevice().

316  {
317  if (needs_dict_translation) {
319  }
320  return memory_level;
321 }

+ Here is the caller graph for this function:

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

References CHECK_GT, and Data_Namespace::GPU_LEVEL.

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

1298  {
1299  const auto entries_per_shard =
1300  shard_count ? (total_entries + shard_count - 1) / shard_count : total_entries;
1301  size_t entries_per_device = entries_per_shard;
1302  if (memory_level == Data_Namespace::GPU_LEVEL && shard_count) {
1303  const auto shards_per_device = (shard_count + device_count - 1) / device_count;
1304  CHECK_GT(shards_per_device, 0u);
1305  entries_per_device = entries_per_shard * shards_per_device;
1306  }
1307  return entries_per_device;
1308 }
#define CHECK_GT(x, y)
Definition: Logger.h:305

+ Here is the caller graph for this function:

const InputTableInfo& get_inner_query_info ( const shared::TableKey inner_table_key,
const std::vector< InputTableInfo > &  query_infos 
)

Definition at line 153 of file PerfectJoinHashTable.cpp.

References CHECK.

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

155  {
156  std::optional<size_t> ti_idx;
157  for (size_t i = 0; i < query_infos.size(); ++i) {
158  if (inner_table_key == query_infos[i].table_key) {
159  ti_idx = i;
160  break;
161  }
162  }
163  CHECK(ti_idx);
164  return query_infos[*ti_idx];
165 }
#define CHECK(condition)
Definition: Logger.h:291

+ Here is the caller graph for this function:

bool needs_dictionary_translation ( const InnerOuter inner_outer_col_pair,
const InnerOuterStringOpInfos inner_outer_string_op_infos,
const Executor executor 
)

Definition at line 315 of file PerfectJoinHashTable.cpp.

References CHECK, CHECK_EQ, get_column_descriptor_maybe(), and get_column_type().

318  {
319  if (inner_outer_string_op_infos.first.size() ||
320  inner_outer_string_op_infos.second.size()) {
321  return true;
322  }
323  auto inner_col = inner_outer_col_pair.first;
324  auto outer_col_expr = inner_outer_col_pair.second;
325  const auto inner_cd = get_column_descriptor_maybe(inner_col->getColumnKey());
326  const auto& inner_col_key = inner_col->getColumnKey();
327  const auto& inner_ti = get_column_type(inner_col_key.column_id,
328  inner_col_key.table_id,
329  inner_cd,
330  executor->getTemporaryTables());
331  // Only strings may need dictionary translation.
332  if (!inner_ti.is_string()) {
333  return false;
334  }
335  const auto outer_col = dynamic_cast<const Analyzer::ColumnVar*>(outer_col_expr);
336  CHECK(outer_col);
337  const auto outer_cd = get_column_descriptor_maybe(outer_col->getColumnKey());
338  // Don't want to deal with temporary tables for now, require translation.
339  if (!inner_cd || !outer_cd) {
340  return true;
341  }
342  const auto& outer_col_key = outer_col->getColumnKey();
343  const auto& outer_ti = get_column_type(outer_col_key.column_id,
344  outer_col_key.table_id,
345  outer_cd,
346  executor->getTemporaryTables());
347  CHECK_EQ(inner_ti.is_string(), outer_ti.is_string());
348  // If the two columns don't share the dictionary, translation is needed.
349  if (outer_ti.getStringDictKey() != inner_ti.getStringDictKey()) {
350  return true;
351  }
352  const auto inner_str_dict_proxy =
353  executor->getStringDictionaryProxy(inner_ti.getStringDictKey(), true);
354  CHECK(inner_str_dict_proxy);
355  const auto outer_str_dict_proxy =
356  executor->getStringDictionaryProxy(outer_ti.getStringDictKey(), true);
357  CHECK(outer_str_dict_proxy);
358 
359  return *inner_str_dict_proxy != *outer_str_dict_proxy;
360 }
#define CHECK_EQ(x, y)
Definition: Logger.h:301
const SQLTypeInfo get_column_type(const int col_id, const int table_id, const ColumnDescriptor *cd, const TemporaryTables *temporary_tables)
Definition: Execute.h:254
const ColumnDescriptor * get_column_descriptor_maybe(const shared::ColumnKey &column_key)
Definition: Execute.h:241
#define CHECK(condition)
Definition: Logger.h:291

+ Here is the call 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 362 of file PerfectJoinHashTable.cpp.

References CHECK_GE.

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

365  {
366  std::vector<Fragmenter_Namespace::FragmentInfo> shards_for_device;
367  for (const auto& fragment : fragments) {
368  CHECK_GE(fragment.shard, 0);
369  if (fragment.shard % device_count == device_id) {
370  shards_for_device.push_back(fragment);
371  }
372  }
373  return shards_for_device;
374 }
#define CHECK_GE(x, y)
Definition: Logger.h:306

+ Here is the caller graph for this function: