OmniSciDB  c1a53651b2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
RegisteredQueryHint Struct Reference

#include <QueryHint.h>

Public Member Functions

 RegisteredQueryHint ()
 
RegisteredQueryHint operator|| (const RegisteredQueryHint &global_hints) const
 
bool isAnyQueryHintDelivered () const
 
void registerHint (const QueryHint hint)
 
bool isHintRegistered (const QueryHint hint) const
 

Static Public Member Functions

static RegisteredQueryHint defaults ()
 
static QueryHint translateQueryHint (const std::string &hint_name)
 

Public Attributes

bool cpu_mode
 
bool columnar_output
 
bool rowwise_output
 
bool keep_result
 
bool keep_table_function_result
 
std::optional< bool > watchdog
 
std::optional< bool > dynamic_watchdog
 
size_t query_time_limit
 
size_t cuda_block_size
 
double cuda_grid_size_multiplier
 
bool opt_cuda_grid_and_block_size
 
size_t aggregate_tree_fanout
 
double overlaps_bucket_threshold
 
size_t overlaps_max_size
 
bool overlaps_allow_gpu_build
 
bool overlaps_no_cache
 
double overlaps_keys_per_bin
 
std::optional< bool > use_loop_join
 
size_t loop_join_inner_table_max_num_rows
 
size_t max_join_hash_table_size
 
std::vector< bool > registered_hint
 

Detailed Description

Definition at line 177 of file QueryHint.h.

Constructor & Destructor Documentation

RegisteredQueryHint::RegisteredQueryHint ( )
inline

Definition at line 185 of file QueryHint.h.

Referenced by defaults().

186  : cpu_mode(false)
187  , columnar_output(false)
188  , rowwise_output(false)
189  , keep_result(false)
191  , watchdog(std::nullopt)
192  , dynamic_watchdog(std::nullopt)
193  , query_time_limit(0)
194  , cuda_block_size(0)
198  , overlaps_bucket_threshold(std::numeric_limits<double>::max())
200  , overlaps_allow_gpu_build(false)
201  , overlaps_no_cache(false)
203  , use_loop_join(std::nullopt)
205  , max_join_hash_table_size(std::numeric_limits<size_t>::max())
bool overlaps_allow_gpu_build
Definition: QueryHint.h:318
double overlaps_keys_per_bin
Definition: QueryHint.h:320
std::optional< bool > dynamic_watchdog
Definition: QueryHint.h:304
double cuda_grid_size_multiplier
Definition: QueryHint.h:309
size_t cuda_block_size
Definition: QueryHint.h:308
std::vector< bool > registered_hint
Definition: QueryHint.h:327
unsigned g_trivial_loop_join_threshold
Definition: Execute.cpp:89
size_t max_join_hash_table_size
Definition: QueryHint.h:325
bool opt_cuda_grid_and_block_size
Definition: QueryHint.h:310
bool keep_table_function_result
Definition: QueryHint.h:302
size_t query_time_limit
Definition: QueryHint.h:305
double g_overlaps_target_entries_per_bin
Definition: Execute.cpp:106
size_t g_overlaps_max_table_size_bytes
Definition: Execute.cpp:105
std::optional< bool > watchdog
Definition: QueryHint.h:303
size_t overlaps_max_size
Definition: QueryHint.h:317
std::optional< bool > use_loop_join
Definition: QueryHint.h:323
size_t loop_join_inner_table_max_num_rows
Definition: QueryHint.h:324
double overlaps_bucket_threshold
Definition: QueryHint.h:316
size_t aggregate_tree_fanout
Definition: QueryHint.h:313

+ Here is the caller graph for this function:

Member Function Documentation

static RegisteredQueryHint RegisteredQueryHint::defaults ( )
inlinestatic

Definition at line 329 of file QueryHint.h.

References RegisteredQueryHint().

Referenced by anonymous_namespace{RelAlgDag.cpp}::create_compound(), RelAlgExecutor::createAggregateWorkUnit(), RelAlgExecutor::createCompoundWorkUnit(), RelAlgExecutor::createFilterWorkUnit(), RelAlgExecutor::createProjectWorkUnit(), RelAlgExecutor::createUnionWorkUnit(), RelAlgExecutor::executeWorkUnit(), QueryRunner::QueryRunner::getParsedQueryHint(), and HashJoin::getSyntheticInstance().

329 { return RegisteredQueryHint(); }

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool RegisteredQueryHint::isAnyQueryHintDelivered ( ) const
inline

Definition at line 338 of file QueryHint.h.

References anonymous_namespace{QueryMemoryDescriptor.cpp}::any_of(), and registered_hint.

Referenced by RelAlgDag::getQueryHint().

338  {
339  const auto identity = [](const bool b) { return b; };
340  return std::any_of(registered_hint.begin(), registered_hint.end(), identity);
341  }
std::vector< bool > registered_hint
Definition: QueryHint.h:327
bool any_of(std::vector< Analyzer::Expr * > const &target_exprs)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool RegisteredQueryHint::isHintRegistered ( const QueryHint  hint) const
inline

Definition at line 348 of file QueryHint.h.

References registered_hint.

Referenced by BaselineJoinHashTableBuilder::allocateDeviceMemory(), anonymous_namespace{IRCodegen.cpp}::check_if_loop_join_is_allowed(), OverlapsJoinHashTable::getEffectiveMemoryLevel(), PerfectJoinHashTable::initHashTableForDevice(), BaselineJoinHashTableBuilder::initHashTableOnCpu(), and OverlapsJoinHashTable::reifyWithLayout().

348  {
349  const auto hint_class = static_cast<int>(hint);
350  return registered_hint.at(hint_class);
351  }
std::vector< bool > registered_hint
Definition: QueryHint.h:327

+ Here is the caller graph for this function:

RegisteredQueryHint RegisteredQueryHint::operator|| ( const RegisteredQueryHint global_hints) const
inline

Definition at line 208 of file QueryHint.h.

References aggregate_tree_fanout, CHECK_EQ, cuda_block_size, cuda_grid_size_multiplier, dynamic_watchdog, kAggregateTreeFanout, kAllowLoopJoin, kColumnarOutput, kCpuMode, kCudaBlockSize, kCudaGridSize, kDisableLoopJoin, kDynamicWatchdog, kDynamicWatchdogOff, keep_result, keep_table_function_result, kHintCount, kKeepResult, kKeepTableFuncResult, kLoopJoinInnerTableMaxNumRows, kMaxJoinHashTableSize, kOptCudaBlockAndGridSizes, kOverlapsAllowGpuBuild, kOverlapsBucketThreshold, kOverlapsKeysPerBin, kOverlapsMaxSize, kOverlapsNoCache, kQueryTimeLimit, kRowwiseOutput, kWatchdog, kWatchdogOff, loop_join_inner_table_max_num_rows, max_join_hash_table_size, overlaps_bucket_threshold, overlaps_keys_per_bin, overlaps_max_size, query_time_limit, registered_hint, UNREACHABLE, use_loop_join, and watchdog.

208  {
209  CHECK_EQ(registered_hint.size(), global_hints.registered_hint.size());
210  // apply registered global hint to the local hint if necessary
211  // we prioritize global hint when both side of hints are enabled simultaneously
212  RegisteredQueryHint updated_query_hints(*this);
213 
214  constexpr int num_hints = static_cast<int>(QueryHint::kHintCount);
215  for (int i = 0; i < num_hints; ++i) {
216  if (global_hints.registered_hint.at(i)) {
217  updated_query_hints.registered_hint.at(i) = true;
218  switch (static_cast<QueryHint>(i)) {
219  case QueryHint::kCpuMode:
220  updated_query_hints.cpu_mode = true;
221  break;
223  updated_query_hints.columnar_output = true;
224  break;
226  updated_query_hints.rowwise_output = true;
227  break;
229  updated_query_hints.cuda_block_size = global_hints.cuda_block_size;
230  break;
232  updated_query_hints.cuda_grid_size_multiplier =
233  global_hints.cuda_grid_size_multiplier;
234  break;
236  updated_query_hints.opt_cuda_grid_and_block_size = true;
237  break;
239  updated_query_hints.overlaps_bucket_threshold =
240  global_hints.overlaps_bucket_threshold;
241  break;
243  updated_query_hints.overlaps_max_size = global_hints.overlaps_max_size;
244  break;
246  updated_query_hints.overlaps_allow_gpu_build = true;
247  break;
249  updated_query_hints.overlaps_no_cache = true;
250  break;
252  updated_query_hints.overlaps_keys_per_bin =
253  global_hints.overlaps_keys_per_bin;
254  break;
256  updated_query_hints.keep_result = global_hints.keep_result;
257  break;
259  updated_query_hints.keep_table_function_result =
260  global_hints.keep_table_function_result;
261  break;
263  updated_query_hints.aggregate_tree_fanout =
264  global_hints.aggregate_tree_fanout;
265  break;
268  updated_query_hints.watchdog = global_hints.watchdog;
269  break;
272  updated_query_hints.dynamic_watchdog = global_hints.dynamic_watchdog;
273  break;
275  updated_query_hints.query_time_limit = global_hints.query_time_limit;
276  break;
279  updated_query_hints.use_loop_join = global_hints.use_loop_join;
280  break;
282  updated_query_hints.loop_join_inner_table_max_num_rows =
284  break;
286  updated_query_hints.max_join_hash_table_size =
287  global_hints.max_join_hash_table_size;
288  break;
289  default:
290  UNREACHABLE();
291  }
292  }
293  }
294  return updated_query_hints;
295  }
#define CHECK_EQ(x, y)
Definition: Logger.h:301
#define UNREACHABLE()
Definition: Logger.h:337
double overlaps_keys_per_bin
Definition: QueryHint.h:320
std::optional< bool > dynamic_watchdog
Definition: QueryHint.h:304
double cuda_grid_size_multiplier
Definition: QueryHint.h:309
size_t cuda_block_size
Definition: QueryHint.h:308
std::vector< bool > registered_hint
Definition: QueryHint.h:327
size_t max_join_hash_table_size
Definition: QueryHint.h:325
bool keep_table_function_result
Definition: QueryHint.h:302
size_t query_time_limit
Definition: QueryHint.h:305
std::optional< bool > watchdog
Definition: QueryHint.h:303
size_t overlaps_max_size
Definition: QueryHint.h:317
std::optional< bool > use_loop_join
Definition: QueryHint.h:323
size_t loop_join_inner_table_max_num_rows
Definition: QueryHint.h:324
double overlaps_bucket_threshold
Definition: QueryHint.h:316
size_t aggregate_tree_fanout
Definition: QueryHint.h:313
void RegisteredQueryHint::registerHint ( const QueryHint  hint)
inline

Definition at line 343 of file QueryHint.h.

References registered_hint.

Referenced by RelAlgDag::registerQueryHints().

343  {
344  const auto hint_class = static_cast<int>(hint);
345  registered_hint.at(hint_class) = true;
346  }
std::vector< bool > registered_hint
Definition: QueryHint.h:327

+ Here is the caller graph for this function:

static QueryHint RegisteredQueryHint::translateQueryHint ( const std::string &  hint_name)
inlinestatic

Definition at line 332 of file QueryHint.h.

References kInvalidHint, and SupportedQueryHints.

Referenced by details::RelAlgDispatcher::parseHintString().

332  {
333  const auto lowered_hint_name = boost::algorithm::to_lower_copy(hint_name);
334  auto it = SupportedQueryHints.find(lowered_hint_name);
335  return it == SupportedQueryHints.end() ? QueryHint::kInvalidHint : it->second;
336  }
static const std::unordered_map< std::string, QueryHint > SupportedQueryHints
Definition: QueryHint.h:58

+ Here is the caller graph for this function:

Member Data Documentation

size_t RegisteredQueryHint::aggregate_tree_fanout
bool RegisteredQueryHint::columnar_output

Definition at line 299 of file QueryHint.h.

Referenced by RelAlgDag::registerQueryHints(), and boost::serialization::serialize().

bool RegisteredQueryHint::cpu_mode

Definition at line 298 of file QueryHint.h.

Referenced by RelAlgDag::registerQueryHints(), and boost::serialization::serialize().

size_t RegisteredQueryHint::cuda_block_size
double RegisteredQueryHint::cuda_grid_size_multiplier
std::optional<bool> RegisteredQueryHint::dynamic_watchdog
bool RegisteredQueryHint::keep_result
bool RegisteredQueryHint::keep_table_function_result
size_t RegisteredQueryHint::loop_join_inner_table_max_num_rows
bool RegisteredQueryHint::opt_cuda_grid_and_block_size

Definition at line 310 of file QueryHint.h.

Referenced by RelAlgDag::registerQueryHints().

double RegisteredQueryHint::overlaps_bucket_threshold
double RegisteredQueryHint::overlaps_keys_per_bin
size_t RegisteredQueryHint::overlaps_max_size
bool RegisteredQueryHint::overlaps_no_cache

Definition at line 319 of file QueryHint.h.

Referenced by RelAlgDag::registerQueryHints(), and boost::serialization::serialize().

size_t RegisteredQueryHint::query_time_limit
std::vector<bool> RegisteredQueryHint::registered_hint
bool RegisteredQueryHint::rowwise_output

Definition at line 300 of file QueryHint.h.

Referenced by RelAlgDag::registerQueryHints(), and boost::serialization::serialize().

std::optional<bool> RegisteredQueryHint::use_loop_join
std::optional<bool> RegisteredQueryHint::watchdog

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