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

#include <Execute.h>

+ Collaboration diagram for CardinalityCacheKey:

Public Member Functions

 CardinalityCacheKey (const RelAlgExecutionUnit &ra_exe_unit)
 
bool operator== (const CardinalityCacheKey &other) const
 
size_t hash () const
 
bool containsTableKey (const shared::TableKey &table_key) const
 

Private Attributes

std::string key
 
std::unordered_set
< shared::TableKey
table_keys
 

Detailed Description

Definition at line 392 of file Execute.h.

Constructor & Destructor Documentation

CardinalityCacheKey::CardinalityCacheKey ( const RelAlgExecutionUnit ra_exe_unit)

Definition at line 1960 of file Execute.cpp.

References RelAlgExecutionUnit::estimator, RelAlgExecutionUnit::groupby_exprs, RelAlgExecutionUnit::input_col_descs, RelAlgExecutionUnit::join_quals, RelAlgExecutionUnit::quals, RelAlgExecutionUnit::scan_limit, RelAlgExecutionUnit::simple_quals, RelAlgExecutionUnit::target_exprs, to_string(), and toString().

1960  {
1961  // todo(yoonmin): replace a cache key as a DAG representation of a query plan
1962  // instead of ra_exec_unit description if possible
1963  std::ostringstream os;
1964  for (const auto& input_col_desc : ra_exe_unit.input_col_descs) {
1965  const auto& scan_desc = input_col_desc->getScanDesc();
1966  os << scan_desc.getTableKey() << "," << input_col_desc->getColId() << ","
1967  << scan_desc.getNestLevel();
1968  table_keys.emplace(scan_desc.getTableKey());
1969  }
1970  if (!ra_exe_unit.simple_quals.empty()) {
1971  for (const auto& qual : ra_exe_unit.simple_quals) {
1972  if (qual) {
1973  os << qual->toString() << ",";
1974  }
1975  }
1976  }
1977  if (!ra_exe_unit.quals.empty()) {
1978  for (const auto& qual : ra_exe_unit.quals) {
1979  if (qual) {
1980  os << qual->toString() << ",";
1981  }
1982  }
1983  }
1984  if (!ra_exe_unit.join_quals.empty()) {
1985  for (size_t i = 0; i < ra_exe_unit.join_quals.size(); i++) {
1986  const auto& join_condition = ra_exe_unit.join_quals[i];
1987  os << std::to_string(i) << ::toString(join_condition.type);
1988  for (const auto& qual : join_condition.quals) {
1989  if (qual) {
1990  os << qual->toString() << ",";
1991  }
1992  }
1993  }
1994  }
1995  if (!ra_exe_unit.groupby_exprs.empty()) {
1996  for (const auto& qual : ra_exe_unit.groupby_exprs) {
1997  if (qual) {
1998  os << qual->toString() << ",";
1999  }
2000  }
2001  }
2002  for (const auto& expr : ra_exe_unit.target_exprs) {
2003  if (expr) {
2004  os << expr->toString() << ",";
2005  }
2006  }
2007  os << ::toString(ra_exe_unit.estimator == nullptr);
2008  os << std::to_string(ra_exe_unit.scan_limit);
2009  key = os.str();
2010 }
std::vector< Analyzer::Expr * > target_exprs
std::unordered_set< shared::TableKey > table_keys
Definition: Execute.h:403
const std::list< std::shared_ptr< Analyzer::Expr > > groupby_exprs
std::string to_string(char const *&&v)
const JoinQualsPerNestingLevel join_quals
const std::shared_ptr< Analyzer::Estimator > estimator
std::string toString(const Executor::ExtModuleKinds &kind)
Definition: Execute.h:1703
std::string key
Definition: Execute.h:402
std::list< std::shared_ptr< Analyzer::Expr > > quals
std::list< std::shared_ptr< const InputColDescriptor > > input_col_descs
std::list< std::shared_ptr< Analyzer::Expr > > simple_quals

+ Here is the call graph for this function:

Member Function Documentation

bool CardinalityCacheKey::containsTableKey ( const shared::TableKey table_key) const

Definition at line 2020 of file Execute.cpp.

2020  {
2021  return table_keys.find(table_key) != table_keys.end();
2022 }
std::unordered_set< shared::TableKey > table_keys
Definition: Execute.h:403
size_t CardinalityCacheKey::hash ( ) const

Definition at line 2016 of file Execute.cpp.

References hash_value().

Referenced by std::hash< CardinalityCacheKey >::operator()().

2016  {
2017  return boost::hash_value(key);
2018 }
std::string key
Definition: Execute.h:402
std::size_t hash_value(RexAbstractInput const &rex_ab_input)
Definition: RelAlgDag.cpp:3548

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool CardinalityCacheKey::operator== ( const CardinalityCacheKey other) const

Definition at line 2012 of file Execute.cpp.

References key.

2012  {
2013  return key == other.key;
2014 }
std::string key
Definition: Execute.h:402

Member Data Documentation

std::string CardinalityCacheKey::key
private

Definition at line 402 of file Execute.h.

Referenced by operator==().

std::unordered_set<shared::TableKey> CardinalityCacheKey::table_keys
private

Definition at line 403 of file Execute.h.


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