OmniSciDB  72c90bc290
 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 1935 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().

1935  {
1936  // todo(yoonmin): replace a cache key as a DAG representation of a query plan
1937  // instead of ra_exec_unit description if possible
1938  std::ostringstream os;
1939  for (const auto& input_col_desc : ra_exe_unit.input_col_descs) {
1940  const auto& scan_desc = input_col_desc->getScanDesc();
1941  os << scan_desc.getTableKey() << "," << input_col_desc->getColId() << ","
1942  << scan_desc.getNestLevel();
1943  table_keys.emplace(scan_desc.getTableKey());
1944  }
1945  if (!ra_exe_unit.simple_quals.empty()) {
1946  for (const auto& qual : ra_exe_unit.simple_quals) {
1947  if (qual) {
1948  os << qual->toString() << ",";
1949  }
1950  }
1951  }
1952  if (!ra_exe_unit.quals.empty()) {
1953  for (const auto& qual : ra_exe_unit.quals) {
1954  if (qual) {
1955  os << qual->toString() << ",";
1956  }
1957  }
1958  }
1959  if (!ra_exe_unit.join_quals.empty()) {
1960  for (size_t i = 0; i < ra_exe_unit.join_quals.size(); i++) {
1961  const auto& join_condition = ra_exe_unit.join_quals[i];
1962  os << std::to_string(i) << ::toString(join_condition.type);
1963  for (const auto& qual : join_condition.quals) {
1964  if (qual) {
1965  os << qual->toString() << ",";
1966  }
1967  }
1968  }
1969  }
1970  if (!ra_exe_unit.groupby_exprs.empty()) {
1971  for (const auto& qual : ra_exe_unit.groupby_exprs) {
1972  if (qual) {
1973  os << qual->toString() << ",";
1974  }
1975  }
1976  }
1977  for (const auto& expr : ra_exe_unit.target_exprs) {
1978  if (expr) {
1979  os << expr->toString() << ",";
1980  }
1981  }
1982  os << ::toString(ra_exe_unit.estimator == nullptr);
1983  os << std::to_string(ra_exe_unit.scan_limit);
1984  key = os.str();
1985 }
std::vector< Analyzer::Expr * > target_exprs
std::unordered_set< shared::TableKey > table_keys
Definition: Execute.h:403
std::string toString(const QueryDescriptionType &type)
Definition: Types.h:64
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 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 1995 of file Execute.cpp.

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

Definition at line 1991 of file Execute.cpp.

References hash_value().

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

1991  {
1992  return boost::hash_value(key);
1993 }
std::string key
Definition: Execute.h:402
std::size_t hash_value(RexAbstractInput const &rex_ab_input)
Definition: RelAlgDag.cpp:3525

+ 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 1987 of file Execute.cpp.

References key.

1987  {
1988  return key == other.key;
1989 }
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: