Skip to content

Commit

Permalink
delete double check agg in where clause (#3647)
Browse files Browse the repository at this point in the history
Co-authored-by: Yee <2520865+yixinglu@users.noreply.github.com>
Co-authored-by: cpw <13495049+CPWstatic@users.noreply.github.com>
  • Loading branch information
3 people authored and Sophie-Xie committed Jan 10, 2022
1 parent 5afa2ff commit f6353c4
Showing 1 changed file with 2 additions and 30 deletions.
32 changes: 2 additions & 30 deletions src/parser/parser.yy
Original file line number Diff line number Diff line change
Expand Up @@ -1635,47 +1635,19 @@ unwind_clause

with_clause
: KW_WITH match_return_items match_order_by match_skip match_limit where_clause {
if ($6 && graph::ExpressionUtils::findAny($6->filter(),{Expression::Kind::kAggregate})) {
delete($2);
delete($3);
delete($4);
delete($5);
delete($6);
throw nebula::GraphParser::syntax_error(@6, "Invalid use of aggregating function in this context.");
}
$$ = new WithClause($2, $3, $4, $5, $6, false/*distinct*/);
}
| KW_WITH KW_DISTINCT match_return_items match_order_by match_skip match_limit where_clause {
if ($7 && graph::ExpressionUtils::findAny($7->filter(),{Expression::Kind::kAggregate})) {
delete($3);
delete($4);
delete($5);
delete($6);
delete($7);
throw nebula::GraphParser::syntax_error(@7, "Invalid use of aggregating function in this context.");
}
$$ = new WithClause($3, $4, $5, $6, $7, true);
}
;

match_clause
: KW_MATCH match_path_list where_clause {
if ($3 && graph::ExpressionUtils::findAny($3->filter(),{Expression::Kind::kAggregate})) {
delete($2);
delete($3);
throw nebula::GraphParser::syntax_error(@3, "Invalid use of aggregating function in this context.");
} else {
$$ = new MatchClause($2, $3, false/*optional*/);
}
$$ = new MatchClause($2, $3, false/*optional*/);
}
| KW_OPTIONAL KW_MATCH match_path_list where_clause {
if ($4 && graph::ExpressionUtils::findAny($4->filter(),{Expression::Kind::kAggregate})) {
delete($3);
delete($4);
throw nebula::GraphParser::syntax_error(@4, "Invalid use of aggregating function in this context.");
} else {
$$ = new MatchClause($3, $4, true);
}
$$ = new MatchClause($3, $4, true);
}
;

Expand Down

0 comments on commit f6353c4

Please sign in to comment.