Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit eea7407

Browse files
laura-dingdutor
andauthored
fix crash (vesoft-inc#2042)
Co-authored-by: dutor <[email protected]>
1 parent 8810ecc commit eea7407

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

src/graph/TraverseExecutor.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ nebula::cpp2::SupportedType TraverseExecutor::calculateExprType(Expression* exp)
142142
case Expression::kInputProp: {
143143
auto* propExp = static_cast<const AliasPropertyExpression*>(exp);
144144
const auto* propName = propExp->prop();
145-
if (inputs_ == nullptr) {
145+
if (inputs_ == nullptr || !inputs_->hasData()) {
146146
return nebula::cpp2::SupportedType::UNKNOWN;
147147
} else {
148148
return inputs_->getColumnType(*propName);

src/graph/test/FetchVerticesTest.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -422,5 +422,17 @@ TEST_F(FetchVerticesTest, NonexistentProp) {
422422
ASSERT_EQ(cpp2::ErrorCode::E_EXECUTION_ERROR, code);
423423
}
424424
}
425+
426+
TEST_F(FetchVerticesTest, EmptyInput) {
427+
// YIELD has input prop, and input is empty
428+
{
429+
cpp2::ExecutionResponse resp;
430+
auto query = "GO FROM 11 over like YIELD like._dst as id "
431+
"| FETCH PROP ON player 11 YIELD $-.id";
432+
auto code = client_->execute(query, resp);
433+
ASSERT_EQ(cpp2::ErrorCode::E_SYNTAX_ERROR, code);
434+
}
435+
}
436+
425437
} // namespace graph
426438
} // namespace nebula

0 commit comments

Comments
 (0)