OmniSciDB  72c90bc290
 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)
 
virtual void acceptChildren (Visitor &v) const override
 
virtual void accept (Visitor &v, std::string name) const override
 
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
 
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 ()
 
virtual size_t toHash () const override
 
- 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
 
bool hasContextData () const
 
const RaExecutionDescgetContextData () const
 
const size_t inputCount () const
 
const RelAlgNodegetInput (const size_t idx) const
 
const std::vector< RelAlgNode
const * > 
getInputs () 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
 
- Public Member Functions inherited from RelAlgDagNode
 RelAlgDagNode ()
 
virtual size_t getStepNumber () const
 
virtual void setStepNumber (size_t step) const
 
std::optional< size_t > getIdInPlanTree () const
 
void setIdInPlanTree (size_t id) 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
 
std::size_t hash_value (RelScan const &)
 

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 > hash_
 
- Protected Attributes inherited from RelAlgDagNode
size_t step_ {0}
 
std::optional< size_t > id_in_plan_tree_
 

Detailed Description

Definition at line 1093 of file RelAlgDag.h.

Constructor & Destructor Documentation

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

Definition at line 1096 of file RelAlgDag.h.

1097  : td_{td}, hint_applied_{false}, catalog_(catalog) {}
const TableDescriptor * td_
Definition: RelAlgDag.h:1174
bool hint_applied_
Definition: RelAlgDag.h:1176
const Catalog_Namespace::Catalog & catalog_
Definition: RelAlgDag.h:1178
RelScan::RelScan ( const TableDescriptor td,
const std::vector< std::string > &  field_names,
const Catalog_Namespace::Catalog catalog 
)
inline

Definition at line 1099 of file RelAlgDag.h.

1102  : td_(td)
1103  , field_names_(field_names)
1104  , hint_applied_(false)
1105  , hints_(std::make_unique<Hints>())
1106  , catalog_(catalog) {}
const TableDescriptor * td_
Definition: RelAlgDag.h:1174
std::vector< std::string > field_names_
Definition: RelAlgDag.h:1175
std::unique_ptr< Hints > hints_
Definition: RelAlgDag.h:1177
bool hint_applied_
Definition: RelAlgDag.h:1176
const Catalog_Namespace::Catalog & catalog_
Definition: RelAlgDag.h:1178

Member Function Documentation

virtual void RelScan::accept ( Visitor v,
std::string  name 
) const
inlineoverridevirtual

Implements RelAlgDagNode.

Definition at line 1109 of file RelAlgDag.h.

References acceptChildren(), and RelAlgDagNode::Visitor::visit().

Referenced by TableFunctionsFactory_node.PrintNode::__str__().

1109  {
1110  if (v.visit(this, std::move(name))) {
1111  acceptChildren(v);
1112  }
1113  }
virtual void acceptChildren(Visitor &v) const override
Definition: RelAlgDag.h:1108
string name
Definition: setup.in.py:72

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

virtual void RelScan::acceptChildren ( Visitor v) const
inlineoverridevirtual

Implements RelAlgDagNode.

Definition at line 1108 of file RelAlgDag.h.

Referenced by accept().

1108 {}

+ Here is the caller graph for this function:

void RelScan::addHint ( const ExplainedQueryHint hint_explained)
inline

Definition at line 1144 of file RelAlgDag.h.

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

1144  {
1145  if (!hint_applied_) {
1146  hint_applied_ = true;
1147  }
1148  hints_->emplace(hint_explained.getHint(), hint_explained);
1149  }
std::unique_ptr< Hints > hints_
Definition: RelAlgDag.h:1177
bool hint_applied_
Definition: RelAlgDag.h:1176
const QueryHint getHint() const
Definition: QueryHint.h:163

+ Here is the call graph for this function:

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

Implements RelAlgNode.

Definition at line 1139 of file RelAlgDag.h.

References CHECK.

1139  {
1140  CHECK(false);
1141  return nullptr;
1142  };
#define CHECK(condition)
Definition: Logger.h:291
const Catalog_Namespace::Catalog& RelScan::getCatalog ( ) const
inline

Definition at line 1119 of file RelAlgDag.h.

References catalog_.

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

1119 { return catalog_; }
const Catalog_Namespace::Catalog & catalog_
Definition: RelAlgDag.h:1178

+ Here is the caller graph for this function:

Hints* RelScan::getDeliveredHints ( )
inline

Definition at line 1167 of file RelAlgDag.h.

References hints_.

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

Definition at line 1127 of file RelAlgDag.h.

References field_names_.

Referenced by RexInput::toString().

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

+ Here is the caller graph for this function:

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

Definition at line 1125 of file RelAlgDag.h.

References field_names_.

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

Definition at line 1158 of file RelAlgDag.h.

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

1158  {
1160  CHECK(!hints_->empty());
1161  CHECK(hasHintEnabled(hint));
1162  return hints_->at(hint);
1163  }
const bool hasHintEnabled(const QueryHint candidate_hint) const
Definition: RelAlgDag.h:1151
std::unique_ptr< Hints > hints_
Definition: RelAlgDag.h:1177
bool hint_applied_
Definition: RelAlgDag.h:1176
#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 1121 of file RelAlgDag.h.

References TableDescriptor::fragmenter, and td_.

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

Definition at line 1123 of file RelAlgDag.h.

References TableDescriptor::nShards, and td_.

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

Definition at line 1117 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().

1117 { return td_; }
const TableDescriptor * td_
Definition: RelAlgDag.h:1174

+ Here is the caller graph for this function:

bool RelScan::hasDeliveredHint ( )
inline

Definition at line 1165 of file RelAlgDag.h.

References hints_.

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

Definition at line 1151 of file RelAlgDag.h.

References hint_applied_, and hints_.

Referenced by getHintInfo().

1151  {
1152  if (hint_applied_ && !hints_->empty()) {
1153  return hints_->find(candidate_hint) != hints_->end();
1154  }
1155  return false;
1156  }
std::unique_ptr< Hints > hints_
Definition: RelAlgDag.h:1177
bool hint_applied_
Definition: RelAlgDag.h:1176

+ Here is the caller graph for this function:

size_t RelScan::size ( ) const
inlineoverridevirtual

Implements RelAlgNode.

Definition at line 1115 of file RelAlgDag.h.

References field_names_.

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

Implements RelAlgNode.

Definition at line 1169 of file RelAlgDag.h.

References hash_value.

1169 { return hash_value(*this); }
friend std::size_t hash_value(RelScan const &)
Definition: RelAlgDag.cpp:3668
std::string RelScan::toString ( RelRexToStringConfig  config = RelRexToStringConfig::defaults()) const
inlineoverridevirtual

Implements RelAlgNode.

Definition at line 1129 of file RelAlgDag.h.

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

1130  {
1131  if (!config.attributes_only) {
1132  return cat(
1133  ::typeName(this), "(", td_->tableName, ", ", ::toString(field_names_), ")");
1134  } else {
1135  return cat(::typeName(this), "(", td_->tableName, ")");
1136  }
1137  }
std::string cat(Ts &&...args)
std::string tableName
const TableDescriptor * td_
Definition: RelAlgDag.h:1174
std::vector< std::string > field_names_
Definition: RelAlgDag.h:1175
std::string toString(RelRexToStringConfig config=RelRexToStringConfig::defaults()) const override
Definition: RelAlgDag.h:1129
std::string typeName(const T *v)
Definition: toString.h:106

+ Here is the call graph for this function:

Friends And Related Function Documentation

std::size_t hash_value ( RelScan const &  rel_scan)
friend

Definition at line 3668 of file RelAlgDag.cpp.

Referenced by toHash().

3668  {
3669  if (rel_scan.hash_) {
3670  return *rel_scan.hash_;
3671  }
3672  rel_scan.hash_ = typeid(RelScan).hash_code();
3673  boost::hash_combine(*rel_scan.hash_, rel_scan.td_->tableId);
3674  boost::hash_combine(*rel_scan.hash_, rel_scan.td_->tableName);
3675  boost::hash_combine(*rel_scan.hash_, ::toString(rel_scan.field_names_));
3676  return *rel_scan.hash_;
3677 }
RelScan(const TableDescriptor *td, const Catalog_Namespace::Catalog &catalog)
Definition: RelAlgDag.h:1096
std::string toString(RelRexToStringConfig config=RelRexToStringConfig::defaults()) const override
Definition: RelAlgDag.h:1129
friend struct RelAlgDagSerializer
friend

Definition at line 1180 of file RelAlgDag.h.

Member Data Documentation

const Catalog_Namespace::Catalog& RelScan::catalog_
private

Definition at line 1178 of file RelAlgDag.h.

Referenced by getCatalog().

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

Definition at line 1175 of file RelAlgDag.h.

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

bool RelScan::hint_applied_
private

Definition at line 1176 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 1174 of file RelAlgDag.h.

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


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