Check for aggregations when planning RegexMatch

Reviewers: mferencevic, ipaljak, dsantl

Reviewed By: mferencevic

Subscribers: pullbot

Differential Revision: https://phabricator.memgraph.io/D2344
This commit is contained in:
Teon Banek 2019-09-02 16:44:02 +02:00
parent 60367a287e
commit 726ae5da6a

View File

@ -278,7 +278,7 @@ class ReturnBodyContext : public HierarchicalTreeVisitor {
#define VISIT_BINARY_OPERATOR(BinaryOperator) \
bool PostVisit(BinaryOperator &op) override { \
CHECK(has_aggregation_.size() >= 2U) \
CHECK(has_aggregation_.size() >= 2U) \
<< "Expected at least 2 has_aggregation_ flags."; \
/* has_aggregation_ stack is reversed, last result is from the 2nd */ \
/* expression. */ \
@ -350,6 +350,15 @@ class ReturnBodyContext : public HierarchicalTreeVisitor {
return true;
}
bool PostVisit(RegexMatch &regex_match) override {
CHECK(has_aggregation_.size() >= 2U)
<< "Expected 2 has_aggregation_ flags for RegexMatch arguments";
bool has_aggr = has_aggregation_.back();
has_aggregation_.pop_back();
has_aggregation_.back() |= has_aggr;
return true;
}
// Creates NamedExpression with an Identifier for each user declared symbol.
// This should be used when body.all_identifiers is true, to generate
// expressions for Produce operator.