Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/null pattern expression input #4180

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions src/graph/validator/MatchValidator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -803,6 +803,7 @@ Status MatchValidator::validateGroup(YieldClauseContext &yieldCtx,
DCHECK(!cols.empty());
for (auto *col : cols) {
auto *colExpr = col->expr();
NG_RETURN_IF_ERROR(validateMatchPathExpr(colExpr, yieldCtx.aliasesAvailable, matchs));
auto colOldName = col->name();
if (colExpr->kind() != Expression::Kind::kAggregate) {
auto collectAggCol = colExpr->clone();
Expand Down Expand Up @@ -834,8 +835,6 @@ Status MatchValidator::validateGroup(YieldClauseContext &yieldCtx,
yieldCtx.groupKeys_.emplace_back(colExpr);
}

NG_RETURN_IF_ERROR(validateMatchPathExpr(colExpr, yieldCtx.aliasesAvailable, matchs));

yieldCtx.groupItems_.emplace_back(colExpr);

yieldCtx.projCols_->addColumn(
Expand Down
18 changes: 18 additions & 0 deletions tests/tck/features/bugfix/AggPatternExpression.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Copyright (c) 2022 vesoft inc. All rights reserved.
#
# This source code is licensed under Apache 2.0 License.
# #4175
Feature: Test crash when aggregate with pattern expression

Background:
Given a graph with space named "nba"

Scenario: Crash when aggregate with pattern expression
# TODO aggregate should bypass all input, like `(v)--(:team)` here
When executing query:
"""
MATCH (v:player) WHERE id(v) == 'Tim Duncan' return v.player.name AS name, size((v)--(:team)) + count(v.player.name) * 2 AS count
"""
Then the result should be, in any order, with relax comparison:
| name | count |
| 'Tim Duncan' | NULL |