forked from vesoft-inc/nebula
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Find path validator. (vesoft-inc#245)
* Add find path validator. * Implement validate. * Remove useless vlog. * Add test. * Refactor. * Address comment. * Rebase and address comment. * Rebase. Co-authored-by: dutor <[email protected]>
- Loading branch information
Showing
11 changed files
with
425 additions
and
273 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/* Copyright (c) 2020 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. | ||
*/ | ||
|
||
#include "validator/FindPathValidator.h" | ||
#include "planner/Logic.h" | ||
|
||
namespace nebula { | ||
namespace graph { | ||
Status FindPathValidator::validateImpl() { | ||
auto fpSentence = static_cast<FindPathSentence*>(sentence_); | ||
isShortest_ = fpSentence->isShortest(); | ||
|
||
NG_RETURN_IF_ERROR(validateStarts(fpSentence->from(), from_)); | ||
NG_RETURN_IF_ERROR(validateStarts(fpSentence->to(), to_)); | ||
NG_RETURN_IF_ERROR(validateOver(fpSentence->over(), over_)); | ||
NG_RETURN_IF_ERROR(validateStep(fpSentence->step(), steps_)); | ||
return Status::OK(); | ||
} | ||
|
||
Status FindPathValidator::toPlan() { | ||
// TODO: Implement the path plan. | ||
auto* passThrough = PassThroughNode::make(qctx_, nullptr); | ||
tail_ = passThrough; | ||
root_ = tail_; | ||
return Status::OK(); | ||
} | ||
} // namespace graph | ||
} // namespace nebula |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/* Copyright (c) 2020 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. | ||
*/ | ||
|
||
#ifndef VALIDATOR_FINDPATHVALIDATOR_H_ | ||
#define VALIDATOR_FINDPATHVALIDATOR_H_ | ||
|
||
#include "common/base/Base.h" | ||
#include "validator/TraversalValidator.h" | ||
|
||
namespace nebula { | ||
namespace graph { | ||
|
||
|
||
class FindPathValidator final : public TraversalValidator { | ||
public: | ||
FindPathValidator(Sentence* sentence, QueryContext* context) | ||
: TraversalValidator(sentence, context) {} | ||
|
||
private: | ||
Status validateImpl() override; | ||
|
||
Status toPlan() override; | ||
|
||
private: | ||
bool isShortest_{false}; | ||
Starts from_; | ||
Starts to_; | ||
Over over_; | ||
Steps steps_; | ||
}; | ||
} // namespace graph | ||
} // namespace nebula | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.