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 crash of null path expression. #3915

Merged
merged 4 commits into from
Feb 21, 2022
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
2 changes: 1 addition & 1 deletion src/graph/planner/match/MatchClausePlanner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,7 @@ Status MatchClausePlanner::projectColumnsBySymbols(MatchClauseContext* matchClau
auto iter = std::find_if(aliases.begin(), aliases.end(), [](const auto& alias) {
return alias.second == AliasType::kPath;
});
if (iter != aliases.end()) {
if (iter != aliases.end() && path.pathBuild != nullptr) {
auto& alias = iter->first;
columns->addColumn(buildPathColumn(path.pathBuild, alias));
colNames.emplace_back(alias);
Expand Down
17 changes: 17 additions & 0 deletions tests/tck/features/bugfix/CrashWhenNullPathExpr.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Copyright (c) 2022 vesoft inc. All rights reserved.
#
# This source code is licensed under Apache 2.0 License.
Feature: Test crash when null path expression

Background:
Given a graph with space named "nba"

Scenario: Null path expression in multiple patterns
When executing query:
"""
MATCH (p:player {name: 'Yao Ming'} ), (t:team {name: 'Rockets'}), pth = (p)-[:serve*1..4]-(t)
RETURN pth
"""
Then the result should be, in any order, with relax comparison:
| pth |
| <("Yao Ming":player{age:38,name:"Yao Ming"})-[:serve@0{end_year:2011,start_year:2002}]->("Rockets":team{name:"Rockets"})> |