19 #include <boost/graph/adjacency_list.hpp>
20 #include <boost/graph/graph_utility.hpp>
21 #include <boost/graph/graphviz.hpp>
22 #include <boost/graph/labeled_graph.hpp>
36 using RelNodeMap = std::unordered_map<RelNodeExplainedHash, RelNodeId>;
41 using QueryPlanDag = boost::labeled_graph<AdjacentList, RelNodeId, boost::hash_mapS>;
54 std::vector<const Analyzer::ColumnVar*>
result;
55 for (
size_t i = 0; i < expr_tuple->
getTuple().size(); ++i) {
56 const auto col_vars = visitor.
visit(expr_tuple->
getTuple()[i].get());
57 for (
const auto col_var : col_vars) {
58 result.push_back(col_var);
65 const std::vector<const Analyzer::ColumnVar*>& aggregate,
66 const std::vector<const Analyzer::ColumnVar*>& next_result)
const override {
68 for (
const auto col_var : next_result) {
81 scan_node_table_key_collector.
visit(rel_alg_node);
82 return std::move(scan_node_table_key_collector.
table_keys_);
132 bool extract_only_col_id);
135 bool col_id_only)
const;
virtual void visit(RelAlgNode const *)
std::optional< RelNodeId > addNodeIfAbsent(const RelAlgNode *)
void connectNodes(const RelNodeId parent_id, const RelNodeId child_id)
void clearQueryPlanCache()
T visit(const Analyzer::Expr *expr) const
size_t getCurrentNodeMapSizeUnlocked() const
size_t getJoinColumnsInfoHash(const Analyzer::Expr *join_expr, JoinColumnSide target_side, bool extract_only_col_id)
static std::unordered_set< size_t > getScanNodeTableKey(RelAlgNode const *rel_alg_node)
ColumnVarsVisitor col_var_visitor_
void visit(RelScan const *scan_node) override
QueryPlanDag cached_query_plan_dag_
size_t max_node_map_size_
const std::vector< std::shared_ptr< Analyzer::Expr > > & getTuple() const
size_t translateColVarsToInfoHash(std::vector< const Analyzer::ColumnVar * > &col_vars, bool col_id_only) const
std::vector< const Analyzer::ColumnVar * > visitColumnVarTuple(const Analyzer::ExpressionTuple *expr_tuple) const override
size_t getCurrentNodeMapCardinality() const
std::shared_ptr< Fragmenter_Namespace::AbstractFragmenter > fragmenter
std::unordered_map< RelNodeExplainedHash, RelNodeId > RelNodeMap
std::vector< const Analyzer::ColumnVar * > aggregateResult(const std::vector< const Analyzer::ColumnVar * > &aggregate, const std::vector< const Analyzer::ColumnVar * > &next_result) const override
QueryPlanDagCache(size_t max_node_cache_size=MAX_NODE_CACHE_SIZE)
boost::labeled_graph< AdjacentList, RelNodeId, boost::hash_mapS > QueryPlanDag
constexpr size_t MAX_NODE_CACHE_SIZE
void setNodeMapMaxSize(const size_t map_size)
std::vector< const Analyzer::ColumnVar * > visitColumnVar(const Analyzer::ColumnVar *column) const override
std::size_t hash_value(RexAbstractInput const &rex_ab_input)
size_t getCurrentNodeMapSize() const
std::unordered_set< size_t > table_keys_
Execution unit for relational algebra. It's a low-level description of any relational algebra operati...
const TableDescriptor * getTableDescriptor() const
std::vector< const Analyzer::ColumnVar * > collectColVars(const Analyzer::Expr *target)
QueryPlanDagCache & operator=(QueryPlanDagCache &&other)=delete