diff --git a/src/graph/planner/match/MatchClausePlanner.cpp b/src/graph/planner/match/MatchClausePlanner.cpp index 3bbc1985593..ed998b79512 100644 --- a/src/graph/planner/match/MatchClausePlanner.cpp +++ b/src/graph/planner/match/MatchClausePlanner.cpp @@ -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); diff --git a/tests/tck/features/bugfix/CrashWhenNullPathExpr.feature b/tests/tck/features/bugfix/CrashWhenNullPathExpr.feature new file mode 100644 index 00000000000..ed5392bf9e3 --- /dev/null +++ b/tests/tck/features/bugfix/CrashWhenNullPathExpr.feature @@ -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"})> |