souffle  2.0.2-371-g6315b36
Public Member Functions | Protected Member Functions
souffle::ram::IndexAggregate Class Reference

Indexed aggregation on a relation. The index allows us to iterate over a restricted range. More...

#include <IndexAggregate.h>

Inheritance diagram for souffle::ram::IndexAggregate:
Inheritance graph
Collaboration diagram for souffle::ram::IndexAggregate:
Collaboration graph

Public Member Functions

void apply (const NodeMapper &map) override
 Apply the mapper to all child nodes. More...
 
IndexAggregateclone () const override
 Create a clone (i.e. More...
 
std::vector< const Node * > getChildNodes () const override
 Obtain list of all embedded child nodes. More...
 
 IndexAggregate (Own< Operation > nested, AggregateOp fun, std::string rel, Own< Expression > expression, Own< Condition > condition, RamPattern queryPattern, int ident)
 
- Public Member Functions inherited from souffle::ram::IndexOperation
void apply (const NodeMapper &map) override
 Apply the mapper to all child nodes. More...
 
IndexOperationclone () const override
 Create a clone (i.e. More...
 
std::vector< const Node * > getChildNodes () const override
 Obtain list of all embedded child nodes. More...
 
std::pair< std::vector< Expression * >, std::vector< Expression * > > getRangePattern () const
 Get range pattern. More...
 
 IndexOperation (std::string rel, int ident, RamPattern queryPattern, Own< Operation > nested, std::string profileText="")
 
void printIndex (std::ostream &os) const
 Helper method for printing. More...
 
- Public Member Functions inherited from souffle::ram::RelationOperation
const std::string & getRelation () const
 Get search relation. More...
 
 RelationOperation (std::string rel, int ident, Own< Operation > nested, std::string profileText="")
 
- Public Member Functions inherited from souffle::ram::TupleOperation
std::vector< const Node * > getChildNodes () const override
 Obtain list of all embedded child nodes. More...
 
int getTupleId () const
 Get identifier. More...
 
void setTupleId (int id)
 Set identifier. More...
 
 TupleOperation (int ident, Own< Operation > nested, std::string profileText="")
 
- Public Member Functions inherited from souffle::ram::NestedOperation
void apply (const NodeMapper &map) override
 Apply the mapper to all child nodes. More...
 
OperationgetOperation () const
 Get nested operation. More...
 
const std::string & getProfileText () const
 Get profile text. More...
 
 NestedOperation (Own< Operation > nested, std::string profileText="")
 
- Public Member Functions inherited from souffle::ram::Node
bool operator!= (const Node &other) const
 Inequality check for two RAM nodes. More...
 
bool operator== (const Node &other) const
 Equivalence check for two RAM nodes. More...
 
virtual void rewrite (const Node *oldNode, Own< Node > newNode)
 Rewrite a child node. More...
 
virtual ~Node ()=default
 
- Public Member Functions inherited from souffle::ram::AbstractAggregate
 AbstractAggregate (AggregateOp fun, Own< Expression > expr, Own< Condition > cond)
 
std::vector< const Node * > getChildNodes () const
 
const ConditiongetCondition () const
 Get condition. More...
 
const ExpressiongetExpression () const
 Get target expression. More...
 
AggregateOp getFunction () const
 Get aggregation function. More...
 
virtual ~AbstractAggregate ()=default
 

Protected Member Functions

bool equal (const Node &node) const override
 Equality check for two RAM nodes. More...
 
void print (std::ostream &os, int tabpos) const override
 Pretty print with indentation. More...
 
- Protected Member Functions inherited from souffle::ram::IndexOperation
bool equal (const Node &node) const override
 Equality check for two RAM nodes. More...
 
- Protected Member Functions inherited from souffle::ram::RelationOperation
bool equal (const Node &node) const override
 Equality check for two RAM nodes. More...
 
- Protected Member Functions inherited from souffle::ram::TupleOperation
bool equal (const Node &node) const override
 Equality check for two RAM nodes. More...
 
- Protected Member Functions inherited from souffle::ram::NestedOperation
void print (std::ostream &os, int tabpos) const override
 Pretty print with indentation. More...
 
- Protected Member Functions inherited from souffle::ram::Operation
void print (std::ostream &os) const override
 Print RAM node. More...
 
- Protected Member Functions inherited from souffle::ram::AbstractAggregate
bool equal (const Node &node) const
 
void print (std::ostream &os, int) const
 

Additional Inherited Members

- Static Protected Member Functions inherited from souffle::ram::Operation
static void print (const Operation *operation, std::ostream &os, int tabpos)
 Pretty print jump-bed. More...
 
- Protected Attributes inherited from souffle::ram::IndexOperation
RamPattern queryPattern
 Values of index per column of table (if indexable) More...
 
- Protected Attributes inherited from souffle::ram::RelationOperation
const std::string relation
 Search relation. More...
 
- Protected Attributes inherited from souffle::ram::TupleOperation
int identifier
 Identifier for the tuple, corresponding to its position in the loop nest. More...
 
- Protected Attributes inherited from souffle::ram::NestedOperation
Own< OperationnestedOperation
 Nested operation. More...
 
const std::string profileText
 Text used by the profiler. More...
 
- Protected Attributes inherited from souffle::ram::AbstractAggregate
Own< Conditioncondition
 Aggregation tuple condition. More...
 
Own< Expressionexpression
 Aggregation expression. More...
 
const AggregateOp function
 Aggregation function. More...
 

Detailed Description

Indexed aggregation on a relation. The index allows us to iterate over a restricted range.

For example:

t0.0=sum t0.1 SEARCH t0 ∈ S ON INDEX t0.0 = number(1)

Definition at line 51 of file IndexAggregate.h.

Constructor & Destructor Documentation

◆ IndexAggregate()

souffle::ram::IndexAggregate::IndexAggregate ( Own< Operation nested,
AggregateOp  fun,
std::string  rel,
Own< Expression expression,
Own< Condition condition,
RamPattern  queryPattern,
int  ident 
)
inline

Definition at line 53 of file IndexAggregate.h.

54  {
55  auto res = IndexOperation::getChildNodes();
56  auto children = AbstractAggregate::getChildNodes();

References souffle::ram::AbstractAggregate::getChildNodes(), and souffle::ram::IndexOperation::getChildNodes().

Here is the call graph for this function:

Member Function Documentation

◆ apply()

void souffle::ram::IndexAggregate::apply ( const NodeMapper )
inlineoverridevirtual

Apply the mapper to all child nodes.

Reimplemented from souffle::ram::Node.

Definition at line 77 of file IndexAggregate.h.

79  :
80  void print(std::ostream& os, int tabpos) const override {
81  os << times(" ", tabpos);

◆ clone()

IndexAggregate* souffle::ram::IndexAggregate::clone ( ) const
inlineoverridevirtual

Create a clone (i.e.

deep copy) of this node

Implements souffle::ram::RelationOperation.

Reimplemented in souffle::ram::ParallelIndexAggregate.

Definition at line 65 of file IndexAggregate.h.

66  : queryPattern.second) {
67  pattern.second.emplace_back(i->clone());
68  }
69  return new IndexAggregate(souffle::clone(&getOperation()), function, relation,
70  souffle::clone(expression), souffle::clone(condition), std::move(pattern), getTupleId());
71  }
72 
73  void apply(const NodeMapper& map) override {
75  condition = map(std::move(condition));

◆ equal()

bool souffle::ram::IndexAggregate::equal ( const Node ) const
inlineoverrideprotectedvirtual

Equality check for two RAM nodes.

Default action is that nothing needs to be checked.

Reimplemented from souffle::ram::Node.

Definition at line 97 of file IndexAggregate.h.

◆ getChildNodes()

std::vector<const Node*> souffle::ram::IndexAggregate::getChildNodes ( ) const
inlineoverridevirtual

Obtain list of all embedded child nodes.

Reimplemented from souffle::ram::Node.

Definition at line 58 of file IndexAggregate.h.

61  {
62  RamPattern pattern;
63  for (const auto& i : queryPattern.first) {

◆ print()

void souffle::ram::IndexAggregate::print ( std::ostream &  os,
int  tabpos 
) const
inlineoverrideprotectedvirtual

Pretty print with indentation.

Implements souffle::ram::Operation.

Reimplemented in souffle::ram::ParallelIndexAggregate.

Definition at line 84 of file IndexAggregate.h.

86  {
87  os << " WHERE " << getCondition();
88  }
89  os << std::endl;
90  IndexOperation::print(os, tabpos + 1);
91  }
92 
93  bool equal(const Node& node) const override {
94  const auto& other = static_cast<const IndexAggregate&>(node);
95  return IndexOperation::equal(other) && AbstractAggregate::equal(other);

The documentation for this class was generated from the following file:
souffle::ram::AbstractAggregate::equal
bool equal(const Node &node) const
Definition: AbstractAggregate.h:94
souffle::ram::IndexOperation::getChildNodes
std::vector< const Node * > getChildNodes() const override
Obtain list of all embedded child nodes.
Definition: IndexOperation.h:74
souffle::ram::AbstractAggregate::getCondition
const Condition & getCondition() const
Get condition.
Definition: AbstractAggregate.h:53
S
#define S(x)
Definition: test.h:179
souffle::ram::NestedOperation::getOperation
Operation & getOperation() const
Get nested operation.
Definition: NestedOperation.h:62
souffle::map
auto map(const std::vector< A > &xs, F &&f)
Applies a function to each element of a vector and returns the results.
Definition: ContainerUtil.h:158
souffle::ram::IndexAggregate::equal
bool equal(const Node &node) const override
Equality check for two RAM nodes.
Definition: IndexAggregate.h:97
souffle::ram::RelationOperation::relation
const std::string relation
Search relation.
Definition: RelationOperation.h:60
souffle::ram::IndexOperation::apply
void apply(const NodeMapper &map) override
Apply the mapper to all child nodes.
Definition: IndexOperation.h:85
souffle::clone
auto clone(const std::vector< A * > &xs)
Definition: ContainerUtil.h:172
souffle::times
detail::multiplying_printer< T > times(const T &value, unsigned num)
A utility printing a given value multiple times.
Definition: StreamUtil.h:322
i
size_t i
Definition: json11.h:663
souffle::ram::IndexAggregate::print
void print(std::ostream &os, int tabpos) const override
Pretty print with indentation.
Definition: IndexAggregate.h:84
souffle::ram::IndexOperation::equal
bool equal(const Node &node) const override
Equality check for two RAM nodes.
Definition: IndexOperation.h:153
souffle::ram::AbstractAggregate::expression
Own< Expression > expression
Aggregation expression.
Definition: AbstractAggregate.h:104
souffle::ram::TupleOperation::getTupleId
int getTupleId() const
Get identifier.
Definition: TupleOperation.h:43
souffle::ram::IndexAggregate::apply
void apply(const NodeMapper &map) override
Apply the mapper to all child nodes.
Definition: IndexAggregate.h:77
souffle::ram::IndexOperation::queryPattern
RamPattern queryPattern
Values of index per column of table (if indexable)
Definition: IndexOperation.h:161
souffle::ram::RamPattern
std::pair< RamBound, RamBound > RamPattern
Definition: IndexOperation.h:42
souffle::ram::IndexAggregate::IndexAggregate
IndexAggregate(Own< Operation > nested, AggregateOp fun, std::string rel, Own< Expression > expression, Own< Condition > condition, RamPattern queryPattern, int ident)
Definition: IndexAggregate.h:53
souffle::ram::AbstractAggregate::getChildNodes
std::vector< const Node * > getChildNodes() const
Definition: AbstractAggregate.h:69
souffle::ram::NestedOperation::print
void print(std::ostream &os, int tabpos) const override
Pretty print with indentation.
Definition: NestedOperation.h:80
souffle::ram::AbstractAggregate::condition
Own< Condition > condition
Aggregation tuple condition.
Definition: AbstractAggregate.h:107