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

#include <RelAlgDag.h>

+ Inheritance diagram for RelScan:
+ Collaboration diagram for RelScan:

Public Member Functions

 RelScan (const TableDescriptor *td, const Catalog_Namespace::Catalog &catalog)
 
 RelScan (const TableDescriptor *td, const std::vector< std::string > &field_names, const Catalog_Namespace::Catalog &catalog)
 
size_t size () const override
 
const TableDescriptorgetTableDescriptor () const
 
const Catalog_Namespace::CataloggetCatalog () const
 
const size_t getNumFragments () const
 
const size_t getNumShards () const
 
const std::vector< std::string > & getFieldNames () const
 
const std::string getFieldName (const size_t i) const
 
std::string toString (RelRexToStringConfig config=RelRexToStringConfig::defaults()) const override
 
size_t toHash () const override
 
std::shared_ptr< RelAlgNodedeepCopy () const override
 
void addHint (const ExplainedQueryHint &hint_explained)
 
const bool hasHintEnabled (const QueryHint candidate_hint) const
 
const ExplainedQueryHintgetHintInfo (QueryHint hint) const
 
bool hasDeliveredHint ()
 
HintsgetDeliveredHints ()
 
- Public Member Functions inherited from RelAlgNode
 RelAlgNode (RelAlgInputs inputs={})
 
virtual ~RelAlgNode ()
 
void resetQueryExecutionState ()
 
void setContextData (const RaExecutionDesc *context_data) const
 
void setOutputMetainfo (std::vector< TargetMetaInfo > targets_metainfo) const
 
void setQueryPlanDag (const std::string &extracted_query_plan_dag) const
 
std::string getQueryPlanDag () const
 
size_t getQueryPlanDagHash () const
 
const std::vector
< TargetMetaInfo > & 
getOutputMetainfo () const
 
unsigned getId () const
 
void setIdInPlanTree (size_t id) const
 
std::optional< size_t > getIdInPlanTree () const
 
bool hasContextData () const
 
const RaExecutionDescgetContextData () const
 
const size_t inputCount () const
 
const RelAlgNodegetInput (const size_t idx) const
 
std::shared_ptr< const RelAlgNodegetAndOwnInput (const size_t idx) const
 
void addManagedInput (std::shared_ptr< const RelAlgNode > input)
 
bool hasInput (const RelAlgNode *needle) const
 
virtual void replaceInput (std::shared_ptr< const RelAlgNode > old_input, std::shared_ptr< const RelAlgNode > input)
 
void setRelNodeDagId (const size_t id) const
 
size_t getRelNodeDagId () const
 
bool isNop () const
 
void markAsNop ()
 
void clearContextData () const
 

Private Attributes

const TableDescriptortd_
 
std::vector< std::string > field_names_
 
bool hint_applied_
 
std::unique_ptr< Hintshints_
 
const Catalog_Namespace::Catalogcatalog_
 

Friends

struct RelAlgDagSerializer
 

Additional Inherited Members

- Static Public Member Functions inherited from RelAlgNode
static void resetRelAlgFirstId () noexcept
 
- Protected Attributes inherited from RelAlgNode
RelAlgInputs inputs_
 
unsigned id_
 
std::optional< size_t > id_in_plan_tree_
 
std::optional< size_t > hash_
 

Detailed Description

Definition at line 969 of file RelAlgDag.h.

Constructor & Destructor Documentation

RelScan::RelScan ( const TableDescriptor td,
const Catalog_Namespace::Catalog catalog 
)
inline

Definition at line 972 of file RelAlgDag.h.

Referenced by toHash().

973  : td_{td}, hint_applied_{false}, catalog_(catalog) {}
const TableDescriptor * td_
Definition: RelAlgDag.h:1045
bool hint_applied_
Definition: RelAlgDag.h:1047
const Catalog_Namespace::Catalog & catalog_
Definition: RelAlgDag.h:1049

+ Here is the caller graph for this function:

RelScan::RelScan ( const TableDescriptor td,
const std::vector< std::string > &  field_names,
const Catalog_Namespace::Catalog catalog 
)
inline

Definition at line 975 of file RelAlgDag.h.

978  : td_(td)
979  , field_names_(field_names)
980  , hint_applied_(false)
981  , hints_(std::make_unique<Hints>())
982  , catalog_(catalog) {}
const TableDescriptor * td_
Definition: RelAlgDag.h:1045
std::vector< std::string > field_names_
Definition: RelAlgDag.h:1046
std::unique_ptr< Hints > hints_
Definition: RelAlgDag.h:1048
bool hint_applied_
Definition: RelAlgDag.h:1047
const Catalog_Namespace::Catalog & catalog_
Definition: RelAlgDag.h:1049

Member Function Documentation

void RelScan::addHint ( const ExplainedQueryHint hint_explained)
inline

Definition at line 1019 of file RelAlgDag.h.

References ExplainedQueryHint::getHint(), hint_applied_, and hints_.

1019  {
1020  if (!hint_applied_) {
1021  hint_applied_ = true;
1022  }
1023  hints_->emplace(hint_explained.getHint(), hint_explained);
1024  }
std::unique_ptr< Hints > hints_
Definition: RelAlgDag.h:1048
bool hint_applied_
Definition: RelAlgDag.h:1047
const QueryHint getHint() const
Definition: QueryHint.h:154

+ Here is the call graph for this function:

std::shared_ptr<RelAlgNode> RelScan::deepCopy ( ) const
inlineoverridevirtual

Implements RelAlgNode.

Definition at line 1014 of file RelAlgDag.h.

References CHECK.

1014  {
1015  CHECK(false);
1016  return nullptr;
1017  };
#define CHECK(condition)
Definition: Logger.h:291
const Catalog_Namespace::Catalog& RelScan::getCatalog ( ) const
inline

Definition at line 988 of file RelAlgDag.h.

References catalog_.

Referenced by anonymous_namespace{QueryPhysicalInputsCollector.cpp}::RelAlgPhysicalTableInputsVisitor::visit().

988 { return catalog_; }
const Catalog_Namespace::Catalog & catalog_
Definition: RelAlgDag.h:1049

+ Here is the caller graph for this function:

Hints* RelScan::getDeliveredHints ( )
inline

Definition at line 1042 of file RelAlgDag.h.

References hints_.

1042 { return hints_.get(); }
std::unique_ptr< Hints > hints_
Definition: RelAlgDag.h:1048
const std::string RelScan::getFieldName ( const size_t  i) const
inline

Definition at line 996 of file RelAlgDag.h.

References field_names_.

Referenced by RexInput::toString().

996 { return field_names_[i]; }
std::vector< std::string > field_names_
Definition: RelAlgDag.h:1046

+ Here is the caller graph for this function:

const std::vector<std::string>& RelScan::getFieldNames ( ) const
inline

Definition at line 994 of file RelAlgDag.h.

References field_names_.

994 { return field_names_; }
std::vector< std::string > field_names_
Definition: RelAlgDag.h:1046
const ExplainedQueryHint& RelScan::getHintInfo ( QueryHint  hint) const
inline

Definition at line 1033 of file RelAlgDag.h.

References CHECK, hasHintEnabled(), hint_applied_, and hints_.

1033  {
1035  CHECK(!hints_->empty());
1036  CHECK(hasHintEnabled(hint));
1037  return hints_->at(hint);
1038  }
const bool hasHintEnabled(const QueryHint candidate_hint) const
Definition: RelAlgDag.h:1026
std::unique_ptr< Hints > hints_
Definition: RelAlgDag.h:1048
bool hint_applied_
Definition: RelAlgDag.h:1047
#define CHECK(condition)
Definition: Logger.h:291

+ Here is the call graph for this function:

const size_t RelScan::getNumFragments ( ) const
inline

Definition at line 990 of file RelAlgDag.h.

References TableDescriptor::fragmenter, and td_.

990 { return td_->fragmenter->getNumFragments(); }
const TableDescriptor * td_
Definition: RelAlgDag.h:1045
std::shared_ptr< Fragmenter_Namespace::AbstractFragmenter > fragmenter
const size_t RelScan::getNumShards ( ) const
inline

Definition at line 992 of file RelAlgDag.h.

References TableDescriptor::nShards, and td_.

992 { return td_->nShards; }
const TableDescriptor * td_
Definition: RelAlgDag.h:1045
const TableDescriptor* RelScan::getTableDescriptor ( ) const
inline

Definition at line 986 of file RelAlgDag.h.

References td_.

Referenced by QueryPlanDagChecker::visit(), ScanNodeTableKeyCollector::visit(), anonymous_namespace{QueryPhysicalInputsCollector.cpp}::RelAlgPhysicalTableInputsVisitor::visit(), and anonymous_namespace{RelAlgExecutor.cpp}::RexUsedInputsVisitor::visitInput().

986 { return td_; }
const TableDescriptor * td_
Definition: RelAlgDag.h:1045

+ Here is the caller graph for this function:

bool RelScan::hasDeliveredHint ( )
inline

Definition at line 1040 of file RelAlgDag.h.

References hints_.

1040 { return !hints_->empty(); }
std::unique_ptr< Hints > hints_
Definition: RelAlgDag.h:1048
const bool RelScan::hasHintEnabled ( const QueryHint  candidate_hint) const
inline

Definition at line 1026 of file RelAlgDag.h.

References hint_applied_, and hints_.

Referenced by getHintInfo().

1026  {
1027  if (hint_applied_ && !hints_->empty()) {
1028  return hints_->find(candidate_hint) != hints_->end();
1029  }
1030  return false;
1031  }
std::unique_ptr< Hints > hints_
Definition: RelAlgDag.h:1048
bool hint_applied_
Definition: RelAlgDag.h:1047

+ Here is the caller graph for this function:

size_t RelScan::size ( ) const
inlineoverridevirtual

Implements RelAlgNode.

Definition at line 984 of file RelAlgDag.h.

References field_names_.

984 { return field_names_.size(); }
std::vector< std::string > field_names_
Definition: RelAlgDag.h:1046
size_t RelScan::toHash ( ) const
inlineoverridevirtual

Implements RelAlgNode.

Definition at line 1004 of file RelAlgDag.h.

References field_names_, RelAlgNode::hash_, RelScan(), TableDescriptor::tableId, TableDescriptor::tableName, td_, and toString().

1004  {
1005  if (!hash_) {
1006  hash_ = typeid(RelScan).hash_code();
1007  boost::hash_combine(*hash_, td_->tableId);
1008  boost::hash_combine(*hash_, td_->tableName);
1009  boost::hash_combine(*hash_, ::toString(field_names_));
1010  }
1011  return *hash_;
1012  }
std::string tableName
const TableDescriptor * td_
Definition: RelAlgDag.h:1045
std::vector< std::string > field_names_
Definition: RelAlgDag.h:1046
RelScan(const TableDescriptor *td, const Catalog_Namespace::Catalog &catalog)
Definition: RelAlgDag.h:972
std::optional< size_t > hash_
Definition: RelAlgDag.h:955
std::string toString(RelRexToStringConfig config=RelRexToStringConfig::defaults()) const override
Definition: RelAlgDag.h:998

+ Here is the call graph for this function:

std::string RelScan::toString ( RelRexToStringConfig  config = RelRexToStringConfig::defaults()) const
inlineoverridevirtual

Implements RelAlgNode.

Definition at line 998 of file RelAlgDag.h.

References cat(), field_names_, TableDescriptor::tableName, td_, and typeName().

Referenced by toHash().

999  {
1000  return cat(
1001  ::typeName(this), "(", td_->tableName, ", ", ::toString(field_names_), ")");
1002  }
std::string cat(Ts &&...args)
std::string tableName
const TableDescriptor * td_
Definition: RelAlgDag.h:1045
std::vector< std::string > field_names_
Definition: RelAlgDag.h:1046
std::string toString(RelRexToStringConfig config=RelRexToStringConfig::defaults()) const override
Definition: RelAlgDag.h:998
std::string typeName(const T *v)
Definition: toString.h:103

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Friends And Related Function Documentation

friend struct RelAlgDagSerializer
friend

Definition at line 1051 of file RelAlgDag.h.

Member Data Documentation

const Catalog_Namespace::Catalog& RelScan::catalog_
private

Definition at line 1049 of file RelAlgDag.h.

Referenced by getCatalog().

std::vector<std::string> RelScan::field_names_
private

Definition at line 1046 of file RelAlgDag.h.

Referenced by getFieldName(), getFieldNames(), size(), toHash(), and toString().

bool RelScan::hint_applied_
private

Definition at line 1047 of file RelAlgDag.h.

Referenced by addHint(), getHintInfo(), and hasHintEnabled().

std::unique_ptr<Hints> RelScan::hints_
private
const TableDescriptor* RelScan::td_
private

Definition at line 1045 of file RelAlgDag.h.

Referenced by getNumFragments(), getNumShards(), getTableDescriptor(), toHash(), and toString().


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