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 the dangle limit crash. #2558

Closed
wants to merge 2 commits into from
Closed
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
10 changes: 10 additions & 0 deletions src/graph/validator/SequentialValidator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,16 @@ Status SequentialValidator::validateImpl() {
break;
}

for (const auto& sentence : sentences) {
switch (sentence->kind()) {
case Sentence::Kind::kLimit:
return Status::SemanticError("Don't allowed dangle Limit sentence.");
default:
// nothing
break;
}
}

seqAstCtx_->startNode = StartNode::make(seqAstCtx_->qctx);
for (auto* sentence : sentences) {
auto validator = makeValidator(sentence, qctx_);
Expand Down
13 changes: 13 additions & 0 deletions tests/tck/features/bugfix/DangleLimit.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Copyright (c) 2021 vesoft inc. All rights reserved.
#
# This source code is licensed under Apache 2.0 License,
# attached with Common Clause Condition 1.0, found in the LICENSES directory.
Feature: Dangle limit

# issue #2548
Scenario: Dangle limit
When executing query:
"""
YIELD 1; LIMIT 1;
"""
Then a SemanticError should be raised at runtime: Don't allowed dangle Limit sentence.