OmniSciDB  c1a53651b2
 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:148
std::vector< Vertex > mergeSortWithInput(const std::vector< Vertex > &vertices, const DAG &graph)
bool g_allow_query_step_skipping
Definition: Execute.cpp:151
std::unordered_set< Vertex > joins_
bool g_enable_data_recycler
Definition: Execute.cpp:146
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 431 of file RelAlgExecutionDescriptor.cpp.

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

431  {
432  if (current_vertex_ == ordering_.size()) {
433  // All descriptors visited, execution finished
434  return true;
435  } else {
436  const auto next_step_id = nextStepId(true);
437  if (!next_step_id || (*next_step_id == totalDescriptorsCount())) {
438  // One step remains (the current vertex), or all remaining steps can be executed
439  // without another broadcast (i.e. on the aggregator)
440  return true;
441  }
442  }
443  return false;
444 }
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 328 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().

328  {
329  const auto pushChildNodes = [&](auto& stack, const auto node_id) {
330  auto [in_edge_iter, in_edge_end] = boost::in_edges(node_id, graph_);
331  while (in_edge_iter != in_edge_end) {
332  const auto child_node_id = boost::source(*in_edge_iter, graph_);
333  stack.push(graph_[child_node_id]);
334  std::advance(in_edge_iter, 1);
335  }
336  };
337  auto top_node_id = descs_.size() - 1;
338  auto top_res = skippable_steps_.emplace(top_node_id, std::unordered_set<int>{});
339  CHECK(top_res.second);
340  for (auto it = descs_.begin(); it != std::prev(descs_.end()); ++it) {
341  const auto step = it->get();
342  const auto body = step->getBody();
343  const auto step_id = static_cast<int>(std::distance(descs_.begin(), it));
344  auto res = skippable_steps_.emplace(step_id, std::unordered_set<int>{});
345  CHECK(res.second);
346  skippable_steps_[top_node_id].insert(step_id); // top-desc can skip all child descs
347  std::stack<const RelAlgNode*> stack;
348  pushChildNodes(stack, node_ptr_to_vert_idx_[body]);
349  while (!stack.empty()) {
350  auto child_node = stack.top();
351  stack.pop();
352  // descs_ is based on the topologically sorted (flattened) DAG, so we can limit the
353  // search range for child descs
354  auto is_desc_body = std::find_if(
355  descs_.begin(), it, [&child_node](std::unique_ptr<RaExecutionDesc>& ptr) {
356  return ptr->getBody() == child_node;
357  });
358  if (is_desc_body != it) {
359  // due to the topological sorting of query plan DAG, we can avoid visiting "all"
360  // child nodes
361  const auto child_step_id =
362  static_cast<int>(std::distance(descs_.begin(), is_desc_body));
363  skippable_steps_[step_id].insert(child_step_id);
364  skippable_steps_[step_id].insert(skippable_steps_[child_step_id].begin(),
365  skippable_steps_[child_step_id].end());
366  } else {
367  pushChildNodes(stack, node_ptr_to_vert_idx_[child_node]);
368  }
369  }
370  }
371 }
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:957
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 456 of file RelAlgExecutionDescriptor.cpp.

References CHECK_LT, and descs_.

Referenced by RelAlgExecutor::executeRelAlgStep().

458  {
459  CHECK_LT(start_idx, descs_.size());
460  auto const from_end = descs_.size() - (start_idx + 1);
461  MatchBody const match_body{body_id};
462  auto const itr = std::find_if(descs_.rbegin() + from_end, descs_.rend(), match_body);
463  return itr == descs_.rend() ? nullptr : itr->get();
464 }
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 282 of file RelAlgExecutionDescriptor.cpp.

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

Referenced by RaExecutionSequence().

284  {
285  DAG::in_edge_iterator ie_iter, ie_end;
286  std::unordered_set<Vertex> inputs;
287  for (const auto vert : vertices) {
288  if (const auto sort = dynamic_cast<const RelSort*>(graph[vert])) {
289  boost::tie(ie_iter, ie_end) = boost::in_edges(vert, graph);
290  CHECK(size_t(1) == sort->inputCount() && boost::next(ie_iter) == ie_end);
291  if (sort->isLimitDelivered()) {
292  has_limit_clause_ = true;
293  }
294  const auto in_vert = boost::source(*ie_iter, graph);
295  const auto input = graph[in_vert];
296  if (dynamic_cast<const RelScan*>(input)) {
297  throw std::runtime_error("Standalone sort not supported yet");
298  }
299  if (boost::out_degree(in_vert, graph) > 1) {
300  throw std::runtime_error("Sort's input node used by others not supported yet");
301  }
302  inputs.insert(in_vert);
303  }
304  }
305 
306  std::vector<Vertex> new_vertices;
307  for (const auto vert : vertices) {
308  if (inputs.count(vert)) {
309  continue;
310  }
311  new_vertices.push_back(vert);
312  }
313  return new_vertices;
314 }
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 cached_query_steps_, cached_resultset_keys_, CHECK, CHECK_GE, 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_->getRecultSetRecyclerHolder().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_->getRecultSetRecyclerHolder().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  checkQueryStepSkippable(node, node->getQueryPlanDagHash(), descs_.size() - 1);
276  }
277  return descs_.back().get();
278  }
279  return nullptr;
280 }
void setOutputMetainfo(std::vector< TargetMetaInfo > targets_metainfo) const
Definition: RelAlgDag.h:861
static ExtractedQueryPlanDag extractQueryPlanDag(const RelAlgNode *top_node, Executor *executor)
bool g_allow_query_step_skipping
Definition: Execute.cpp:151
#define CHECK_GE(x, y)
Definition: Logger.h:306
std::unordered_set< Vertex > joins_
size_t getQueryPlanDagHash() const
Definition: RelAlgDag.h:874
std::unordered_set< int > cached_query_steps_
unsigned getId() const
Definition: RelAlgDag.h:880
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 418 of file RelAlgExecutionDescriptor.cpp.

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

Referenced by executionFinished().

418  {
419  if (after_broadcast) {
420  if (current_vertex_ == ordering_.size()) {
421  return std::nullopt;
422  }
423  return descs_.size() + stepsToNextBroadcast();
424  } else if (current_vertex_ == ordering_.size()) {
425  return std::nullopt;
426  } else {
427  return descs_.size();
428  }
429 }
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 316 of file RelAlgExecutionDescriptor.cpp.

References CHECK_GE, and descs_.

316  {
317  if (descs_.empty()) {
318  return nullptr;
319  }
320  if (descs_.size() == 1) {
321  return nullptr;
322  }
323  CHECK_GE(descs_.size(), size_t(2));
324  auto itr = descs_.rbegin();
325  return (++itr)->get();
326 }
#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 373 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().

373  {
374  CHECK_LE(cached_query_steps_.size(), descs_.size());
375 
376  // extract skippable query steps`
377  std::unordered_set<int> skippable_query_steps;
378  for (const auto cached_step_id : cached_query_steps_) {
379  auto it = skippable_steps_.find(cached_step_id);
380  CHECK(it != skippable_steps_.end());
381  const auto& child_steps = it->second;
382  std::for_each(
383  child_steps.begin(), child_steps.end(), [&](const auto& skippable_step_id) {
384  if (skippable_step_id != cached_step_id) {
385  skippable_query_steps.insert(skippable_step_id);
386  }
387  });
388  }
389 
390  // modify query step sequence based on the skippable query steps
391  if (!skippable_query_steps.empty()) {
392  std::vector<std::unique_ptr<RaExecutionDesc>> new_descs;
393  for (size_t step_id = 0; step_id < descs_.size(); ++step_id) {
394  const auto body = descs_[step_id]->getBody();
395  if (!skippable_query_steps.count(step_id)) {
396  new_descs.push_back(std::make_unique<RaExecutionDesc>(body));
397  }
398  }
399  const auto prev_num_steps = descs_.size();
400  if (!new_descs.empty()) {
401  std::swap(descs_, new_descs);
402  }
403  VLOG(1) << "Skip " << prev_num_steps - descs_.size() << " query steps from "
404  << prev_num_steps << " steps";
405  }
406 
407  for (const auto& desc : descs_) {
408  // remove cached resultset info for each desc since
409  // it is not skipped
410  auto body = desc->getBody();
411  auto it = cached_resultset_keys_.find(-body->getId());
412  if (it != cached_resultset_keys_.end()) {
413  cached_resultset_keys_.erase(it);
414  }
415  }
416 }
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:387

+ 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 484 of file RelAlgExecutionDescriptor.cpp.

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

Referenced by nextStepId().

484  {
485  size_t steps_to_next_broadcast = 0;
486  auto crt_vertex = current_vertex_;
487  while (crt_vertex < ordering_.size()) {
488  auto vert = ordering_[crt_vertex++];
489  auto node = graph_[vert];
490  CHECK(node);
491  if (joins_.count(vert)) {
492  auto join_node = dynamic_cast<const RelLeftDeepInnerJoin*>(node);
493  CHECK(join_node);
494  for (size_t i = 0; i < join_node->inputCount(); i++) {
495  const auto input = join_node->getInput(i);
496  if (dynamic_cast<const RelScan*>(input)) {
497  return steps_to_next_broadcast;
498  }
499  }
500  if (crt_vertex < ordering_.size() - 1) {
501  // Force the parent node of the RelLeftDeepInnerJoin to run on the aggregator.
502  // Note that crt_vertex has already been incremented once above for the join node
503  // -- increment it again to account for the parent node of the join
504  ++steps_to_next_broadcast;
505  ++crt_vertex;
506  continue;
507  } else {
508  CHECK_EQ(crt_vertex, ordering_.size() - 1);
509  // If the join node parent is the last node in the tree, run all remaining steps
510  // on the aggregator
511  return ++steps_to_next_broadcast;
512  }
513  }
514  if (auto sort = dynamic_cast<const RelSort*>(node)) {
515  CHECK_EQ(sort->inputCount(), size_t(1));
516  node = sort->getInput(0);
517  }
518  if (dynamic_cast<const RelScan*>(node)) {
519  return steps_to_next_broadcast;
520  }
521  if (dynamic_cast<const RelModify*>(node)) {
522  // Modify runs on the leaf automatically, run the same node as a noop on the
523  // aggregator
524  ++steps_to_next_broadcast;
525  continue;
526  }
527  if (auto project = dynamic_cast<const RelProject*>(node)) {
528  if (project->hasWindowFunctionExpr()) {
529  ++steps_to_next_broadcast;
530  continue;
531  }
532  }
533  for (size_t input_idx = 0; input_idx < node->inputCount(); input_idx++) {
534  if (dynamic_cast<const RelScan*>(node->getInput(input_idx))) {
535  return steps_to_next_broadcast;
536  }
537  }
538  ++steps_to_next_broadcast;
539  }
540  return steps_to_next_broadcast;
541 }
#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 466 of file RelAlgExecutionDescriptor.cpp.

References CHECK, graph_, joins_, and ordering_.

Referenced by executionFinished().

466  {
467  size_t num_descriptors = 0;
468  size_t crt_vertex = 0;
469  while (crt_vertex < ordering_.size()) {
470  auto vert = ordering_[crt_vertex++];
471  if (joins_.count(vert)) {
472  continue;
473  }
474  auto& node = graph_[vert];
475  CHECK(node);
476  if (dynamic_cast<const RelScan*>(node)) {
477  continue;
478  }
479  ++num_descriptors;
480  }
481  return num_descriptors;
482 }
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: