Class RelAlgDagBuilder¶
-
class
RelAlgDagBuilder
: public noncopyable¶ Builder class to create an in-memory, easy-to-navigate relational algebra DAG interpreted from a JSON representation from Calcite. Also, applies high level optimizations which can be expressed through relational algebra extended with RelCompound. The RelCompound node is an equivalent representation for sequences of RelFilter, RelProject and RelAggregate nodes. This coalescing minimizes the amount of intermediate buffers required to evaluate a query. Lower level optimizations are taken care by lower levels, mainly RelAlgTranslator and the IR code generation.
Public Functions
-
RelAlgDagBuilder
()¶
-
RelAlgDagBuilder
(const std::string &query_ra, const Catalog_Namespace::Catalog &cat, const RenderInfo *render_info)¶ Constructs a RelAlg DAG from a JSON representation.
- Parameters
query_ra
: A JSON string representation of an RA tree from Calcite.cat
: DB catalog for the current user.render_opts
: Additional build options for render queries.
-
RelAlgDagBuilder
(RelAlgDagBuilder &root_dag_builder, const rapidjson::Value &query_ast, const Catalog_Namespace::Catalog &cat, const RenderInfo *render_opts)¶ Constructs a sub-DAG for any subqueries. Should only be called during DAG building.
- Parameters
root_dag_builder
: The root DAG builder. The root stores pointers to all subqueries.query_ast
: The current JSON node to build a DAG for.cat
: DB catalog for the current user.render_opts
: Additional build options for render queries.
-
void
eachNode
(std::function<void(RelAlgNode const *)> const &callback) const¶
-
const RelAlgNode &
getRootNode
() const¶ Returns the root node of the DAG.
-
std::shared_ptr<const RelAlgNode>
getRootNodeShPtr
() const¶
Registers a subquery with a root DAG builder. Should only be called during DAG building and registration should only occur on the root.
-
const std::vector<std::shared_ptr<RexSubQuery>> &
getSubqueries
() const¶ Gets all registered subqueries. Only the root DAG can contain subqueries.
-
std::optional<RegisteredQueryHint>
getQueryHint
(const RelAlgNode *node) const¶
-
std::unordered_map<size_t, std::unordered_map<unsigned, RegisteredQueryHint>> &
getQueryHints
()¶
-
const RegisteredQueryHint &
getGlobalHints
() const¶
-
void
setGlobalQueryHints
(const RegisteredQueryHint &global_hints)¶
-
void
resetQueryExecutionState
()¶ Gets all registered subqueries. Only the root DAG can contain subqueries.
Private Functions
-
void
build
(const rapidjson::Value &query_ast, RelAlgDagBuilder &root_dag_builder)¶
Private Members
-
std::vector<std::shared_ptr<RelAlgNode>>
nodes_
¶
-
std::vector<std::shared_ptr<RexSubQuery>>
subqueries_
¶
-
const RenderInfo *
render_info_
¶
-
std::unordered_map<size_t, std::unordered_map<unsigned, RegisteredQueryHint>>
query_hint_
¶
-
RegisteredQueryHint
global_hints_
¶
-