OmniSciDB  0264ff685a
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::JoinHashTableCacheKey
 

Functions

bool needs_dictionary_translation (const Analyzer::ColumnVar *inner_col, const Analyzer::Expr *outer_col, const Executor *executor)
 
std::vector< Fragmenter_Namespace::FragmentInfoonly_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

◆ get_entries_per_device()

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

References CHECK_GT, and Data_Namespace::GPU_LEVEL.

Referenced by OverlapsJoinHashTable::calculateCounts(), OverlapsJoinHashTable::getInstance(), and BaselineJoinHashTable::reifyWithLayout().

962  {
963  const auto entries_per_shard =
964  shard_count ? (total_entries + shard_count - 1) / shard_count : total_entries;
965  size_t entries_per_device = entries_per_shard;
966  if (memory_level == Data_Namespace::GPU_LEVEL && shard_count) {
967  const auto shards_per_device = (shard_count + device_count - 1) / device_count;
968  CHECK_GT(shards_per_device, 0u);
969  entries_per_device = entries_per_shard * shards_per_device;
970  }
971  return entries_per_device;
972 }
#define CHECK_GT(x, y)
Definition: Logger.h:209
+ Here is the caller graph for this function:

◆ get_inner_query_info()

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

Definition at line 945 of file PerfectJoinHashTable.cpp.

References CHECK.

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

947  {
948  std::optional<size_t> ti_idx;
949  for (size_t i = 0; i < query_infos.size(); ++i) {
950  if (inner_table_id == query_infos[i].table_id) {
951  ti_idx = i;
952  break;
953  }
954  }
955  CHECK(ti_idx);
956  return query_infos[*ti_idx];
957 }
#define CHECK(condition)
Definition: Logger.h:197
+ Here is the caller graph for this function:

◆ needs_dictionary_translation()

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

Definition at line 255 of file PerfectJoinHashTable.cpp.

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

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

257  {
258  const auto catalog = executor->getCatalog();
259  CHECK(catalog);
260  const auto inner_cd = get_column_descriptor_maybe(
261  inner_col->get_column_id(), inner_col->get_table_id(), *catalog);
262  const auto& inner_ti = get_column_type(inner_col->get_column_id(),
263  inner_col->get_table_id(),
264  inner_cd,
265  executor->getTemporaryTables());
266  // Only strings may need dictionary translation.
267  if (!inner_ti.is_string()) {
268  return false;
269  }
270  const auto outer_col = dynamic_cast<const Analyzer::ColumnVar*>(outer_col_expr);
271  CHECK(outer_col);
272  const auto outer_cd = get_column_descriptor_maybe(
273  outer_col->get_column_id(), outer_col->get_table_id(), *catalog);
274  // Don't want to deal with temporary tables for now, require translation.
275  if (!inner_cd || !outer_cd) {
276  return true;
277  }
278  const auto& outer_ti = get_column_type(outer_col->get_column_id(),
279  outer_col->get_table_id(),
280  outer_cd,
281  executor->getTemporaryTables());
282  CHECK_EQ(inner_ti.is_string(), outer_ti.is_string());
283  // If the two columns don't share the dictionary, translation is needed.
284  return outer_ti.get_comp_param() != inner_ti.get_comp_param();
285 }
#define CHECK_EQ(x, y)
Definition: Logger.h:205
int get_column_id() const
Definition: Analyzer.h:195
const SQLTypeInfo get_column_type(const int col_id, const int table_id, const ColumnDescriptor *cd, const TemporaryTables *temporary_tables)
Definition: Execute.h:232
const ColumnDescriptor * get_column_descriptor_maybe(const int col_id, const int table_id, const Catalog_Namespace::Catalog &cat)
Definition: Execute.h:216
int get_table_id() const
Definition: Analyzer.h:194
#define CHECK(condition)
Definition: Logger.h:197
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ only_shards_for_device()

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

References CHECK_GE.

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

290  {
291  std::vector<Fragmenter_Namespace::FragmentInfo> shards_for_device;
292  for (const auto& fragment : fragments) {
293  CHECK_GE(fragment.shard, 0);
294  if (fragment.shard % device_count == device_id) {
295  shards_for_device.push_back(fragment);
296  }
297  }
298  return shards_for_device;
299 }
#define CHECK_GE(x, y)
Definition: Logger.h:210
+ Here is the caller graph for this function: