OmniSciDB  ca0c39ec8f
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
DataRecyclerUtil Class Reference

#include <DataRecycler.h>

Static Public Member Functions

static std::string getDeviceIdentifierString (DeviceIdentifier device_identifier)
 
static QueryPlanHash getUnitaryTableKey ()
 
static std::unordered_set< size_t > getAlternativeTableKeys (const std::vector< ChunkKey > &chunk_keys, int db_id, int inner_table_id)
 

Static Public Attributes

static constexpr DeviceIdentifier CPU_DEVICE_IDENTIFIER = 0
 

Detailed Description

Definition at line 134 of file DataRecycler.h.

Member Function Documentation

static std::unordered_set<size_t> DataRecyclerUtil::getAlternativeTableKeys ( const std::vector< ChunkKey > &  chunk_keys,
int  db_id,
int  inner_table_id 
)
inlinestatic

Definition at line 154 of file DataRecycler.h.

References getUnitaryTableKey().

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

157  {
158  std::unordered_set<size_t> alternative_table_keys;
159  if (!chunk_keys.empty() && chunk_keys.front().size() > 2 &&
160  chunk_keys.front()[1] > 0) {
161  auto& chunk_key = chunk_keys.front();
162  // the actual chunks fetched per device can be different but they constitute the
163  // same table in the same db, so we can exploit this to create an alternative table
164  // key
165  std::vector<int> alternative_table_key{chunk_key[0], chunk_key[1]};
166  alternative_table_keys.insert(boost::hash_value(alternative_table_key));
167  } else if (inner_table_id > 0) {
168  // use this path if chunk_keys is empty
169  std::vector<int> alternative_table_key{db_id, inner_table_id};
170  alternative_table_keys.insert(boost::hash_value(alternative_table_key));
171  } else {
172  // this can happen when we use synthetic table generated by table function such as
173  // generate_series, i.e., SELECT ... FROM table(generate_series(...)) ...
174  // then we try to manage them via predefined static chunk key
175  // and remove them "all" when necessary
176  alternative_table_keys.insert(DataRecyclerUtil::getUnitaryTableKey());
177  }
178  return alternative_table_keys;
179  }
static QueryPlanHash getUnitaryTableKey()
Definition: DataRecycler.h:145

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static std::string DataRecyclerUtil::getDeviceIdentifierString ( DeviceIdentifier  device_identifier)
inlinestatic

Definition at line 138 of file DataRecycler.h.

References CPU_DEVICE_IDENTIFIER, and to_string().

Referenced by HashingSchemeRecycler::clearCache(), OverlapsTuningParamRecycler::clearCache(), ChunkMetadataRecycler::clearCache(), ResultSetRecycler::clearCache(), HashtableRecycler::clearCache(), ChunkMetadataRecycler::getItemFromCache(), HashingSchemeRecycler::putItemToCache(), OverlapsTuningParamRecycler::putItemToCache(), ChunkMetadataRecycler::putItemToCache(), ResultSetRecycler::putItemToCache(), HashtableRecycler::putItemToCache(), HashingSchemeRecycler::removeItemFromCache(), OverlapsTuningParamRecycler::removeItemFromCache(), ChunkMetadataRecycler::removeItemFromCache(), ResultSetRecycler::removeItemFromCache(), HashtableRecycler::removeItemFromCache(), HashingSchemeRecycler::toString(), ChunkMetadataRecycler::toString(), ResultSetRecycler::toString(), and HashtableRecycler::toString().

138  {
139  std::string device_type = device_identifier == CPU_DEVICE_IDENTIFIER ? "CPU" : "GPU-";
140  return device_identifier != CPU_DEVICE_IDENTIFIER
141  ? device_type.append(std::to_string(device_identifier))
142  : device_type;
143  }
std::string to_string(char const *&&v)
static constexpr DeviceIdentifier CPU_DEVICE_IDENTIFIER
Definition: DataRecycler.h:136

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static QueryPlanHash DataRecyclerUtil::getUnitaryTableKey ( )
inlinestatic

Definition at line 145 of file DataRecycler.h.

Referenced by getAlternativeTableKeys(), and HashtableRecycler::removeCachedHashtableBuiltFromSyntheticTable().

145  {
146  // C++20 will support constexpr vector
147  // Before we have C++20, let's use a pre-computed constant which is retrieved from
148  // std::vector<int> unitary_table_identifier = {-1, -1};
149  // UNITARY_TABLE_ID_HASH_VALUE = boost::hash_value(unitary_table_identifier);
150  constexpr QueryPlanHash UNITARY_TABLE_ID_HASH_VALUE = 1703092966009212028;
151  return UNITARY_TABLE_ID_HASH_VALUE;
152  }
size_t QueryPlanHash

+ Here is the caller graph for this function:

Member Data Documentation


The documentation for this class was generated from the following file: