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

A container for relational algebra descriptors defining the execution order for a relational algebra query. Holds the relational algebra descriptors for executing a relational algebra query. Each descriptor holds both a top-level relational algebra node and a ResultSet ptr holding the results from the execution of the accompany node(s). The sequence can be generated on initialization or lazily with calls to the next() operator. More...

#include <RelAlgExecutionDescriptor.h>

+ Collaboration diagram for RaExecutionSequence:

Public Member Functions

 RaExecutionSequence (const RelAlgNode *, Executor *, const bool build_sequence=true)
 
 RaExecutionSequence (std::unique_ptr< RaExecutionDesc > exec_desc)
 
RaExecutionDescnext ()
 
RaExecutionDescprev ()
 
std::optional< size_t > nextStepId (const bool after_broadcast) const
 
bool executionFinished () const
 
void extractQueryStepSkippingInfo ()
 
void skipQuerySteps ()
 
std::vector< VertexmergeSortWithInput (const std::vector< Vertex > &vertices, const DAG &graph)
 
const std::unordered_map< int,
QueryPlanHash
getSkippedQueryStepCacheKeys () const
 
RaExecutionDescgetDescriptor (size_t idx) const
 
RaExecutionDescgetDescriptorByBodyId (unsigned const body_id, size_t const start_idx) const
 
size_t size () const
 
bool empty () const
 
size_t totalDescriptorsCount () const
 
const bool hasQueryStepForUnion () const
 

Private Member Functions

size_t stepsToNextBroadcast () const
 

Private Attributes

DAG graph_
 
Executorexecutor_
 
std::unordered_set< Vertexjoins_
 
std::vector< Vertexordering_
 
size_t current_vertex_ = 0
 
size_t scan_count_ = 0
 
std::unordered_map< const
RelAlgNode *, int > 
node_ptr_to_vert_idx_
 
std::unordered_map< int,
std::unordered_set< int > > 
skippable_steps_
 
std::unordered_set< int > cached_query_steps_
 
std::unordered_map< int,
QueryPlanHash
cached_resultset_keys_
 
bool has_step_for_union_ {false}
 
bool has_limit_clause_ {false}
 
std::vector< std::unique_ptr
< RaExecutionDesc > > 
descs_
 

Detailed Description

A container for relational algebra descriptors defining the execution order for a relational algebra query. Holds the relational algebra descriptors for executing a relational algebra query. Each descriptor holds both a top-level relational algebra node and a ResultSet ptr holding the results from the execution of the accompany node(s). The sequence can be generated on initialization or lazily with calls to the next() operator.

Definition at line 133 of file RelAlgExecutionDescriptor.h.

Constructor & Destructor Documentation

RaExecutionSequence::RaExecutionSequence ( const RelAlgNode sink,
Executor executor,
const bool  build_sequence = true 
)

Definition at line 209 of file RelAlgExecutionDescriptor.cpp.

References anonymous_namespace{RelAlgExecutionDescriptor.cpp}::build_dag(), CHECK, executor_, extractQueryStepSkippingInfo(), g_allow_query_step_skipping, g_cluster, g_enable_data_recycler, g_use_query_resultset_cache, anonymous_namespace{RelAlgExecutionDescriptor.cpp}::get_join_vertices(), graph_, has_step_for_union_, joins_, mergeSortWithInput(), next(), node_ptr_to_vert_idx_, ordering_, gpu_enabled::reverse(), and skipQuerySteps().

211  {
212  CHECK(sink);
213  CHECK(executor);
214  if (dynamic_cast<const RelScan*>(sink) || dynamic_cast<const RelJoin*>(sink)) {
215  throw std::runtime_error("Query not supported yet");
216  }
217  executor_ = executor;
219 
220  boost::topological_sort(graph_, std::back_inserter(ordering_));
221  std::reverse(ordering_.begin(), ordering_.end());
222 
223  ordering_ = mergeSortWithInput(ordering_, graph_);
224  joins_ = get_join_vertices(ordering_, graph_);
225 
226  if (build_sequence) {
227  while (next()) {
228  // noop
229  }
233  skipQuerySteps();
234  }
235  }
236 }
bool g_use_query_resultset_cache
Definition: Execute.cpp:160
std::vector< Vertex > mergeSortWithInput(const std::vector< Vertex > &vertices, const DAG &graph)
bool g_allow_query_step_skipping
Definition: Execute.cpp:163
std::unordered_set< Vertex > joins_
bool g_enable_data_recycler
Definition: Execute.cpp:158
DAG build_dag(const RelAlgNode *sink, std::unordered_map< const RelAlgNode *, int > &node_ptr_to_vert_idx)
std::unordered_map< const RelAlgNode *, int > node_ptr_to_vert_idx_
std::unordered_set< Vertex > get_join_vertices(const std::vector< Vertex > &vertices, const DAG &graph)
std::vector< Vertex > ordering_
#define CHECK(condition)
Definition: Logger.h:291
bool g_cluster
DEVICE void reverse(ARGS &&...args)
Definition: gpu_enabled.h:96

+ Here is the call graph for this function:

RaExecutionSequence::RaExecutionSequence ( std::unique_ptr< RaExecutionDesc exec_desc)

Definition at line 238 of file RelAlgExecutionDescriptor.cpp.

References descs_.

238  {
239  descs_.emplace_back(std::move(exec_desc));
240 }
std::vector< std::unique_ptr< RaExecutionDesc > > descs_

Member Function Documentation

bool RaExecutionSequence::empty ( ) const
inline

Definition at line 189 of file RelAlgExecutionDescriptor.h.

References descs_.

Referenced by RelAlgExecutor::executeRelAlgSeq().

189 { return descs_.empty(); }
std::vector< std::unique_ptr< RaExecutionDesc > > descs_

+ Here is the caller graph for this function:

bool RaExecutionSequence::executionFinished ( ) const

Definition at line 437 of file RelAlgExecutionDescriptor.cpp.

References current_vertex_, nextStepId(), ordering_, and totalDescriptorsCount().

437  {
438  if (current_vertex_ == ordering_.size()) {
439  // All descriptors visited, execution finished
440  return true;
441  } else {
442  const auto next_step_id = nextStepId(true);
443  if (!next_step_id || (*next_step_id == totalDescriptorsCount())) {
444  // One step remains (the current vertex), or all remaining steps can be executed
445  // without another broadcast (i.e. on the aggregator)
446  return true;
447  }
448  }
449  return false;
450 }
std::vector< Vertex > ordering_
std::optional< size_t > nextStepId(const bool after_broadcast) const

+ Here is the call graph for this function:

void RaExecutionSequence::extractQueryStepSkippingInfo ( )

Extracts a topological information of the query plan DAG about the relationship among query steps where a parent step and its child steps can be skipped if we have a cached resultset of the parent step

Definition at line 334 of file RelAlgExecutionDescriptor.cpp.

References CHECK, descs_, graph_, anonymous_namespace{RelAlgDag.cpp}::node_id(), node_ptr_to_vert_idx_, run_benchmark_import::res, and skippable_steps_.

Referenced by RaExecutionSequence().

334  {
335  const auto pushChildNodes = [&](auto& stack, const auto node_id) {
336  auto [in_edge_iter, in_edge_end] = boost::in_edges(node_id, graph_);
337  while (in_edge_iter != in_edge_end) {
338  const auto child_node_id = boost::source(*in_edge_iter, graph_);
339  stack.push(graph_[child_node_id]);
340  std::advance(in_edge_iter, 1);
341  }
342  };
343  auto top_node_id = descs_.size() - 1;
344  auto top_res = skippable_steps_.emplace(top_node_id, std::unordered_set<int>{});
345  CHECK(top_res.second);
346  for (auto it = descs_.begin(); it != std::prev(descs_.end()); ++it) {
347  const auto step = it->get();
348  const auto body = step->getBody();
349  const auto step_id = static_cast<int>(std::distance(descs_.begin(), it));
350  auto res = skippable_steps_.emplace(step_id, std::unordered_set<int>{});
351  CHECK(res.second);
352  skippable_steps_[top_node_id].insert(step_id); // top-desc can skip all child descs
353  std::stack<const RelAlgNode*> stack;
354  pushChildNodes(stack, node_ptr_to_vert_idx_[body]);
355  while (!stack.empty()) {
356  auto child_node = stack.top();
357  stack.pop();
358  // descs_ is based on the topologically sorted (flattened) DAG, so we can limit the
359  // search range for child descs
360  auto is_desc_body = std::find_if(
361  descs_.begin(), it, [&child_node](std::unique_ptr<RaExecutionDesc>& ptr) {
362  return ptr->getBody() == child_node;
363  });
364  if (is_desc_body != it) {
365  // due to the topological sorting of query plan DAG, we can avoid visiting "all"
366  // child nodes
367  const auto child_step_id =
368  static_cast<int>(std::distance(descs_.begin(), is_desc_body));
369  skippable_steps_[step_id].insert(child_step_id);
370  skippable_steps_[step_id].insert(skippable_steps_[child_step_id].begin(),
371  skippable_steps_[child_step_id].end());
372  } else {
373  pushChildNodes(stack, node_ptr_to_vert_idx_[child_node]);
374  }
375  }
376  }
377 }
std::vector< std::unique_ptr< RaExecutionDesc > > descs_
std::unordered_map< const RelAlgNode *, int > node_ptr_to_vert_idx_
#define CHECK(condition)
Definition: Logger.h:291
unsigned node_id(const rapidjson::Value &ra_node) noexcept
Definition: RelAlgDag.cpp:973
std::unordered_map< int, std::unordered_set< int > > skippable_steps_

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

RaExecutionDesc* RaExecutionSequence::getDescriptor ( size_t  idx) const
inline

Definition at line 180 of file RelAlgExecutionDescriptor.h.

References CHECK_LT, and descs_.

Referenced by RelAlgExecutor::executeRelAlgQuerySingleStep(), RelAlgExecutor::executeRelAlgSeq(), RelAlgExecutor::executeRelAlgStep(), and RelAlgExecutor::executeRelAlgSubSeq().

180  {
181  CHECK_LT(idx, descs_.size());
182  return descs_[idx].get();
183  }
std::vector< std::unique_ptr< RaExecutionDesc > > descs_
#define CHECK_LT(x, y)
Definition: Logger.h:303

+ Here is the caller graph for this function:

RaExecutionDesc * RaExecutionSequence::getDescriptorByBodyId ( unsigned const  body_id,
size_t const  start_idx 
) const

Definition at line 462 of file RelAlgExecutionDescriptor.cpp.

References CHECK_LT, and descs_.

Referenced by RelAlgExecutor::executeRelAlgStep().

464  {
465  CHECK_LT(start_idx, descs_.size());
466  auto const from_end = descs_.size() - (start_idx + 1);
467  MatchBody const match_body{body_id};
468  auto const itr = std::find_if(descs_.rbegin() + from_end, descs_.rend(), match_body);
469  return itr == descs_.rend() ? nullptr : itr->get();
470 }
std::vector< std::unique_ptr< RaExecutionDesc > > descs_
#define CHECK_LT(x, y)
Definition: Logger.h:303

+ Here is the caller graph for this function:

const std::unordered_map<int, QueryPlanHash> RaExecutionSequence::getSkippedQueryStepCacheKeys ( ) const
inline

Definition at line 176 of file RelAlgExecutionDescriptor.h.

References cached_resultset_keys_.

Referenced by RelAlgExecutor::executeRelAlgSeq().

176  {
177  return cached_resultset_keys_;
178  }
std::unordered_map< int, QueryPlanHash > cached_resultset_keys_

+ Here is the caller graph for this function:

const bool RaExecutionSequence::hasQueryStepForUnion ( ) const
inline

Definition at line 193 of file RelAlgExecutionDescriptor.h.

References has_step_for_union_.

Referenced by RelAlgExecutor::executeRelAlgSeq(), and RelAlgExecutor::executeRelAlgStep().

+ Here is the caller graph for this function:

std::vector< Vertex > RaExecutionSequence::mergeSortWithInput ( const std::vector< Vertex > &  vertices,
const DAG graph 
)

Definition at line 288 of file RelAlgExecutionDescriptor.cpp.

References CHECK, has_limit_clause_, and gpu_enabled::sort().

Referenced by RaExecutionSequence().

290  {
291  DAG::in_edge_iterator ie_iter, ie_end;
292  std::unordered_set<Vertex> inputs;
293  for (const auto vert : vertices) {
294  if (const auto sort = dynamic_cast<const RelSort*>(graph[vert])) {
295  boost::tie(ie_iter, ie_end) = boost::in_edges(vert, graph);
296  CHECK(size_t(1) == sort->inputCount() && boost::next(ie_iter) == ie_end);
297  if (sort->isLimitDelivered()) {
298  has_limit_clause_ = true;
299  }
300  const auto in_vert = boost::source(*ie_iter, graph);
301  const auto input = graph[in_vert];
302  if (dynamic_cast<const RelScan*>(input)) {
303  throw std::runtime_error("Standalone sort not supported yet");
304  }
305  if (boost::out_degree(in_vert, graph) > 1) {
306  throw std::runtime_error("Sort's input node used by others not supported yet");
307  }
308  inputs.insert(in_vert);
309  }
310  }
311 
312  std::vector<Vertex> new_vertices;
313  for (const auto vert : vertices) {
314  if (inputs.count(vert)) {
315  continue;
316  }
317  new_vertices.push_back(vert);
318  }
319  return new_vertices;
320 }
DEVICE void sort(ARGS &&...args)
Definition: gpu_enabled.h:105
#define CHECK(condition)
Definition: Logger.h:291

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

RaExecutionDesc * RaExecutionSequence::next ( )

Return the next execution descriptor in the sequence. If no more execution descriptors exist, returns nullptr.

Definition at line 242 of file RelAlgExecutionDescriptor.cpp.

References QueryPlanDagExtractor::applyLimitClauseToCacheKey(), cached_query_steps_, cached_resultset_keys_, CHECK, CHECK_GE, SortInfo::createFromSortNode(), current_vertex_, descs_, EMPTY_QUERY_PLAN, executor_, QueryPlanDagExtractor::extractQueryPlanDag(), g_allow_query_step_skipping, RelAlgNode::getId(), RelAlgNode::getQueryPlanDagHash(), graph_, has_step_for_union_, joins_, ordering_, scan_count_, and RelAlgNode::setOutputMetainfo().

Referenced by RaExecutionSequence().

242  {
243  auto checkQueryStepSkippable =
244  [&](RelAlgNode const* node, QueryPlanHash key, size_t step_id) {
245  CHECK_GE(step_id, 0);
246  if (executor_->getResultSetRecyclerHolder().hasCachedQueryResultSet(key)) {
247  cached_query_steps_.insert(step_id);
248  cached_resultset_keys_.emplace(-node->getId(), key);
249  const auto output_meta_info =
250  executor_->getResultSetRecyclerHolder().getOutputMetaInfo(key);
251  CHECK(output_meta_info);
252  node->setOutputMetainfo(*output_meta_info);
253  }
254  };
255  while (current_vertex_ < ordering_.size()) {
256  auto vert = ordering_[current_vertex_++];
257  if (joins_.count(vert)) {
258  continue;
259  }
260  auto& node = graph_[vert];
261  CHECK(node);
262  if (dynamic_cast<const RelScan*>(node)) {
263  scan_count_++;
264  continue;
265  }
266  descs_.emplace_back(std::make_unique<RaExecutionDesc>(node));
267  auto logical_union = dynamic_cast<const RelLogicalUnion*>(node);
268  if (logical_union) {
269  has_step_for_union_ = true;
270  }
271  auto extracted_query_plan_dag =
274  !boost::iequals(extracted_query_plan_dag.extracted_dag, EMPTY_QUERY_PLAN)) {
275  SortInfo sort_info;
276  if (auto sort_node = dynamic_cast<const RelSort*>(node)) {
277  sort_info = SortInfo::createFromSortNode(sort_node);
278  }
280  node->getQueryPlanDagHash(), sort_info);
281  checkQueryStepSkippable(node, cache_key, descs_.size() - 1);
282  }
283  return descs_.back().get();
284  }
285  return nullptr;
286 }
void setOutputMetainfo(std::vector< TargetMetaInfo > targets_metainfo) const
Definition: RelAlgDag.h:850
static ExtractedQueryPlanDag extractQueryPlanDag(const RelAlgNode *top_node, Executor *executor)
static size_t applyLimitClauseToCacheKey(size_t cache_key, SortInfo const &sort_info)
bool g_allow_query_step_skipping
Definition: Execute.cpp:163
#define CHECK_GE(x, y)
Definition: Logger.h:306
std::unordered_set< Vertex > joins_
static SortInfo createFromSortNode(const RelSort *sort_node)
size_t getQueryPlanDagHash() const
Definition: RelAlgDag.h:863
std::unordered_set< int > cached_query_steps_
unsigned getId() const
Definition: RelAlgDag.h:869
std::vector< std::unique_ptr< RaExecutionDesc > > descs_
std::vector< Vertex > ordering_
size_t QueryPlanHash
constexpr char const * EMPTY_QUERY_PLAN
#define CHECK(condition)
Definition: Logger.h:291
std::unordered_map< int, QueryPlanHash > cached_resultset_keys_

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

std::optional< size_t > RaExecutionSequence::nextStepId ( const bool  after_broadcast) const

Returns the index of the next execution descriptor in the graph. If after_broadcast is true, returns the index of the first execution descriptor after the next global broadcast. Returns std::nullopt if no execution descriptors remain in the graph.

Definition at line 424 of file RelAlgExecutionDescriptor.cpp.

References current_vertex_, descs_, ordering_, and stepsToNextBroadcast().

Referenced by executionFinished().

424  {
425  if (after_broadcast) {
426  if (current_vertex_ == ordering_.size()) {
427  return std::nullopt;
428  }
429  return descs_.size() + stepsToNextBroadcast();
430  } else if (current_vertex_ == ordering_.size()) {
431  return std::nullopt;
432  } else {
433  return descs_.size();
434  }
435 }
std::vector< std::unique_ptr< RaExecutionDesc > > descs_
std::vector< Vertex > ordering_

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

RaExecutionDesc * RaExecutionSequence::prev ( )

Return the previous execution descriptor in the sequence. If the sequence is made up of 0 or 1 descriptors, returns nullptr.

Definition at line 322 of file RelAlgExecutionDescriptor.cpp.

References CHECK_GE, and descs_.

322  {
323  if (descs_.empty()) {
324  return nullptr;
325  }
326  if (descs_.size() == 1) {
327  return nullptr;
328  }
329  CHECK_GE(descs_.size(), size_t(2));
330  auto itr = descs_.rbegin();
331  return (++itr)->get();
332 }
#define CHECK_GE(x, y)
Definition: Logger.h:306
std::vector< std::unique_ptr< RaExecutionDesc > > descs_
size_t RaExecutionSequence::size ( ) const
inline

Definition at line 188 of file RelAlgExecutionDescriptor.h.

References descs_.

Referenced by RelAlgExecutor::executeRelAlgQueryWithFilterPushDown(), and RelAlgExecutor::executeRelAlgSeq().

188 { return descs_.size(); }
std::vector< std::unique_ptr< RaExecutionDesc > > descs_

+ Here is the caller graph for this function:

void RaExecutionSequence::skipQuerySteps ( )

Optimizes the query execution step based on the information extracted from the extractQueryStepSkippingInfo function

Definition at line 379 of file RelAlgExecutionDescriptor.cpp.

References cached_query_steps_, cached_resultset_keys_, CHECK, CHECK_LE, descs_, skippable_steps_, gpu_enabled::swap(), and VLOG.

Referenced by RaExecutionSequence().

379  {
380  CHECK_LE(cached_query_steps_.size(), descs_.size());
381 
382  // extract skippable query steps`
383  std::unordered_set<int> skippable_query_steps;
384  for (const auto cached_step_id : cached_query_steps_) {
385  auto it = skippable_steps_.find(cached_step_id);
386  CHECK(it != skippable_steps_.end());
387  const auto& child_steps = it->second;
388  std::for_each(
389  child_steps.begin(), child_steps.end(), [&](const auto& skippable_step_id) {
390  if (skippable_step_id != cached_step_id) {
391  skippable_query_steps.insert(skippable_step_id);
392  }
393  });
394  }
395 
396  // modify query step sequence based on the skippable query steps
397  if (!skippable_query_steps.empty()) {
398  std::vector<std::unique_ptr<RaExecutionDesc>> new_descs;
399  for (size_t step_id = 0; step_id < descs_.size(); ++step_id) {
400  const auto body = descs_[step_id]->getBody();
401  if (!skippable_query_steps.count(step_id)) {
402  new_descs.push_back(std::make_unique<RaExecutionDesc>(body));
403  }
404  }
405  const auto prev_num_steps = descs_.size();
406  if (!new_descs.empty()) {
407  std::swap(descs_, new_descs);
408  }
409  VLOG(1) << "Skip " << prev_num_steps - descs_.size() << " query steps from "
410  << prev_num_steps << " steps";
411  }
412 
413  for (const auto& desc : descs_) {
414  // remove cached resultset info for each desc since
415  // it is not skipped
416  auto body = desc->getBody();
417  auto it = cached_resultset_keys_.find(-body->getId());
418  if (it != cached_resultset_keys_.end()) {
419  cached_resultset_keys_.erase(it);
420  }
421  }
422 }
std::unordered_set< int > cached_query_steps_
std::vector< std::unique_ptr< RaExecutionDesc > > descs_
#define CHECK_LE(x, y)
Definition: Logger.h:304
#define CHECK(condition)
Definition: Logger.h:291
DEVICE void swap(ARGS &&...args)
Definition: gpu_enabled.h:114
std::unordered_map< int, std::unordered_set< int > > skippable_steps_
std::unordered_map< int, QueryPlanHash > cached_resultset_keys_
#define VLOG(n)
Definition: Logger.h:388

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

size_t RaExecutionSequence::stepsToNextBroadcast ( ) const
private

Starting from the current vertex, iterate the graph counting the number of execution descriptors remaining before the next required broadcast step. The current vertex is counted as the first step before a broadcast is required; i.e. a return value of 0 indicates no additional steps in the graph can be executed without a global broadcast, and a return value of 2 indicates the current vertex and both subsequent vertices can be executed before a global broacast is needed.

Definition at line 490 of file RelAlgExecutionDescriptor.cpp.

References CHECK, CHECK_EQ, current_vertex_, graph_, joins_, ordering_, and gpu_enabled::sort().

Referenced by nextStepId().

490  {
491  size_t steps_to_next_broadcast = 0;
492  auto crt_vertex = current_vertex_;
493  while (crt_vertex < ordering_.size()) {
494  auto vert = ordering_[crt_vertex++];
495  auto node = graph_[vert];
496  CHECK(node);
497  if (joins_.count(vert)) {
498  auto join_node = dynamic_cast<const RelLeftDeepInnerJoin*>(node);
499  CHECK(join_node);
500  for (size_t i = 0; i < join_node->inputCount(); i++) {
501  const auto input = join_node->getInput(i);
502  if (dynamic_cast<const RelScan*>(input)) {
503  return steps_to_next_broadcast;
504  }
505  }
506  if (crt_vertex < ordering_.size() - 1) {
507  // Force the parent node of the RelLeftDeepInnerJoin to run on the aggregator.
508  // Note that crt_vertex has already been incremented once above for the join node
509  // -- increment it again to account for the parent node of the join
510  ++steps_to_next_broadcast;
511  ++crt_vertex;
512  continue;
513  } else {
514  CHECK_EQ(crt_vertex, ordering_.size() - 1);
515  // If the join node parent is the last node in the tree, run all remaining steps
516  // on the aggregator
517  return ++steps_to_next_broadcast;
518  }
519  }
520  if (auto sort = dynamic_cast<const RelSort*>(node)) {
521  CHECK_EQ(sort->inputCount(), size_t(1));
522  node = sort->getInput(0);
523  }
524  if (dynamic_cast<const RelScan*>(node)) {
525  return steps_to_next_broadcast;
526  }
527  if (dynamic_cast<const RelModify*>(node)) {
528  // Modify runs on the leaf automatically, run the same node as a noop on the
529  // aggregator
530  ++steps_to_next_broadcast;
531  continue;
532  }
533  if (auto project = dynamic_cast<const RelProject*>(node)) {
534  if (project->hasWindowFunctionExpr()) {
535  ++steps_to_next_broadcast;
536  continue;
537  }
538  }
539  for (size_t input_idx = 0; input_idx < node->inputCount(); input_idx++) {
540  if (dynamic_cast<const RelScan*>(node->getInput(input_idx))) {
541  return steps_to_next_broadcast;
542  }
543  }
544  ++steps_to_next_broadcast;
545  }
546  return steps_to_next_broadcast;
547 }
#define CHECK_EQ(x, y)
Definition: Logger.h:301
DEVICE void sort(ARGS &&...args)
Definition: gpu_enabled.h:105
std::unordered_set< Vertex > joins_
std::vector< Vertex > ordering_
#define CHECK(condition)
Definition: Logger.h:291

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

size_t RaExecutionSequence::totalDescriptorsCount ( ) const

Definition at line 472 of file RelAlgExecutionDescriptor.cpp.

References CHECK, graph_, joins_, and ordering_.

Referenced by executionFinished().

472  {
473  size_t num_descriptors = 0;
474  size_t crt_vertex = 0;
475  while (crt_vertex < ordering_.size()) {
476  auto vert = ordering_[crt_vertex++];
477  if (joins_.count(vert)) {
478  continue;
479  }
480  auto& node = graph_[vert];
481  CHECK(node);
482  if (dynamic_cast<const RelScan*>(node)) {
483  continue;
484  }
485  ++num_descriptors;
486  }
487  return num_descriptors;
488 }
std::unordered_set< Vertex > joins_
std::vector< Vertex > ordering_
#define CHECK(condition)
Definition: Logger.h:291

+ Here is the caller graph for this function:

Member Data Documentation

std::unordered_set<int> RaExecutionSequence::cached_query_steps_
private

Definition at line 207 of file RelAlgExecutionDescriptor.h.

Referenced by next(), and skipQuerySteps().

std::unordered_map<int, QueryPlanHash> RaExecutionSequence::cached_resultset_keys_
private

Definition at line 208 of file RelAlgExecutionDescriptor.h.

Referenced by getSkippedQueryStepCacheKeys(), next(), and skipQuerySteps().

size_t RaExecutionSequence::current_vertex_ = 0
private
std::vector<std::unique_ptr<RaExecutionDesc> > RaExecutionSequence::descs_
private
Executor* RaExecutionSequence::executor_
private

Definition at line 197 of file RelAlgExecutionDescriptor.h.

Referenced by next(), and RaExecutionSequence().

DAG RaExecutionSequence::graph_
private
bool RaExecutionSequence::has_limit_clause_ {false}
private

Definition at line 210 of file RelAlgExecutionDescriptor.h.

Referenced by mergeSortWithInput().

bool RaExecutionSequence::has_step_for_union_ {false}
private

Definition at line 209 of file RelAlgExecutionDescriptor.h.

Referenced by hasQueryStepForUnion(), next(), and RaExecutionSequence().

std::unordered_set<Vertex> RaExecutionSequence::joins_
private
std::unordered_map<const RelAlgNode*, int> RaExecutionSequence::node_ptr_to_vert_idx_
private
std::vector<Vertex> RaExecutionSequence::ordering_
private
size_t RaExecutionSequence::scan_count_ = 0
private

Definition at line 202 of file RelAlgExecutionDescriptor.h.

Referenced by next().

std::unordered_map<int, std::unordered_set<int> > RaExecutionSequence::skippable_steps_
private

Definition at line 205 of file RelAlgExecutionDescriptor.h.

Referenced by extractQueryStepSkippingInfo(), and skipQuerySteps().


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