mutable
A Database System for Research and Fast Prototyping
Loading...
Searching...
No Matches
Data Structures | Macros | Functions
QueryGraph.cpp File Reference
#include "IR/QueryGraph.hpp"
#include "IR/QueryGraph2SQL.hpp"
#include "parse/ASTDumper.hpp"
#include <mutable/catalog/Catalog.hpp>
#include <mutable/IR/CNF.hpp>
#include <mutable/parse/AST.hpp>
#include <mutable/util/macro.hpp>
Include dependency graph for QueryGraph.cpp:

Go to the source code of this file.

Data Structures

struct  GetNestedQueries
 Helper structure to extract the QueryExprs in an expression. More...
 

Macros

#define q(X)   '"' << X << '"'
 
#define id(X)   q(std::hex << &X << std::dec)
 

Functions

std::vector< std::reference_wrapper< const ast::FnApplicationExpr > > get_aggregates (const ast::SelectStmt &stmt)
 Given a SelectStmt stmt, extract the aggregates to compute while grouping.
 
bool is_composable_of (const ast::Expr &expr, const std::vector< std::reference_wrapper< const ast::Expr > > components)
 Computes whether the bound parts of expr are composable of elements in components.
 
bool equal (const ast::Designator &one, const ast::Designator &two)
 Returns true iff both designators has the same textual representation.
 
void emplace_back_unique (std::vector< std::pair< const ast::Expr *, PooledOptionalString > > &pairs, const std::pair< const ast::Designator *, PooledOptionalString > &pair)
 Like std::vector::emplace_back() but adds only iff pair is not already contained in pairs.
 
void emplace_back_unique (std::vector< std::pair< const ast::Expr *, PooledOptionalString > > &pairs, const std::pair< const ast::Expr *, PooledOptionalString > &pair)
 Like std::vector::emplace_back() but adds only iff pair is not already contained in pairs.
 
void emplace_back (std::vector< const ast::Expr * > &exprs, const ast::Designator *des)
 Like std::vector::emplace_back() but adds only iff des is not already contained in exprs.
 
void emplace_back_unique (std::vector< const ast::Expr * > &exprs, const ast::Expr *expr)
 Like std::vector::emplace_back() but adds only iff expr is not already contained in exprs.
 
void emplace_back_unique (std::vector< DataSource * > &sources, DataSource *src)
 Like std::vector::emplace_back() but adds only iff src is not already contained in sources.
 
void insert (std::vector< const ast::Expr * > &exprs, const std::vector< const ast::Designator * > &insertions)
 Like std::vector::insert() but adds only those elements of insertions which are not already contained in exprs.
 
void insert (std::vector< const ast::Expr * > &exprs, const std::vector< const ast::Expr * > &insertions)
 Like std::vector::insert() but adds only those elements of insertions which are not already contained in exprs.
 
auto get_primary_key (DataSource *source)
 Helper structure to compute and provide primary keys.
 

Macro Definition Documentation

◆ id

#define id (   X)    q(std::hex << &X << std::dec)

◆ q

#define q (   X)    '"' << X << '"'

Function Documentation

◆ emplace_back()

void emplace_back ( std::vector< const ast::Expr * > &  exprs,
const ast::Designator *  des 
)

Like std::vector::emplace_back() but adds only iff des is not already contained in exprs.

Definition at line 580 of file QueryGraph.cpp.

References m::and, and m::equal().

Referenced by emplace_back_unique(), and insert().

◆ emplace_back_unique() [1/4]

void emplace_back_unique ( std::vector< const ast::Expr * > &  exprs,
const ast::Expr *  expr 
)

Like std::vector::emplace_back() but adds only iff expr is not already contained in exprs.

Definition at line 590 of file QueryGraph.cpp.

References m::contains(), and emplace_back().

◆ emplace_back_unique() [2/4]

void emplace_back_unique ( std::vector< DataSource * > &  sources,
DataSource src 
)

Like std::vector::emplace_back() but adds only iff src is not already contained in sources.

Definition at line 599 of file QueryGraph.cpp.

References m::DataSource::name().

◆ emplace_back_unique() [3/4]

void emplace_back_unique ( std::vector< std::pair< const ast::Expr *, PooledOptionalString > > &  pairs,
const std::pair< const ast::Designator *, PooledOptionalString > &  pair 
)

Like std::vector::emplace_back() but adds only iff pair is not already contained in pairs.

Definition at line 559 of file QueryGraph.cpp.

References m::and, and m::equal().

Referenced by emplace_back_unique().

◆ emplace_back_unique() [4/4]

void emplace_back_unique ( std::vector< std::pair< const ast::Expr *, PooledOptionalString > > &  pairs,
const std::pair< const ast::Expr *, PooledOptionalString > &  pair 
)

Like std::vector::emplace_back() but adds only iff pair is not already contained in pairs.

Definition at line 570 of file QueryGraph.cpp.

References m::contains(), and emplace_back_unique().

◆ equal()

bool equal ( const ast::Designator &  one,
const ast::Designator &  two 
)

Returns true iff both designators has the same textual representation.

Definition at line 554 of file QueryGraph.cpp.

References m::streq(), and m::to_string().

◆ get_aggregates()

std::vector< std::reference_wrapper< const ast::FnApplicationExpr > > get_aggregates ( const ast::SelectStmt &  stmt)

Given a SelectStmt stmt, extract the aggregates to compute while grouping.

Definition at line 348 of file QueryGraph.cpp.

References m::ast::SelectStmt::having, M_insist, m::ast::SelectStmt::order_by, m::ast::SelectStmt::select, m::to_string(), and m::visit().

◆ get_primary_key()

auto get_primary_key ( DataSource source)

Helper structure to compute and provide primary keys.

Compute and provide all primary keys of source.

Definition at line 714 of file QueryGraph.cpp.

◆ insert() [1/2]

void insert ( std::vector< const ast::Expr * > &  exprs,
const std::vector< const ast::Designator * > &  insertions 
)

Like std::vector::insert() but adds only those elements of insertions which are not already contained in exprs.

Definition at line 610 of file QueryGraph.cpp.

References emplace_back().

Referenced by m::wasm::ChainedHashTable< IsGlobal >::insert_key(), and m::wasm::OpenAddressingHashTable< IsGlobal, ValueInPlace >::insert_key().

◆ insert() [2/2]

void insert ( std::vector< const ast::Expr * > &  exprs,
const std::vector< const ast::Expr * > &  insertions 
)

Like std::vector::insert() but adds only those elements of insertions which are not already contained in exprs.

Definition at line 617 of file QueryGraph.cpp.

References m::contains(), and emplace_back().

◆ is_composable_of()

bool is_composable_of ( const ast::Expr &  expr,
const std::vector< std::reference_wrapper< const ast::Expr > >  components 
)

Computes whether the bound parts of expr are composable of elements in components.

Definition at line 383 of file QueryGraph.cpp.

References m::and, is_composable_of(), and m::visit().

Referenced by is_composable_of(), and m::GraphBuilder::process_selection().